Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Using wildcards with string values of a variable

From   Fred Wolfe <>
Subject   Re: st: Using wildcards with string values of a variable
Date   Fri, 13 Jan 2006 06:16:24 -0600

See this function from Stata help

strmatch(s1,s2) evaluates to 1 if s1 matches the pattern s2; otherwise, it returns 0.

At 06:08 AM 1/13/2006, you wrote:

Hi Statalist users,

I am using the metatrim command (sbe39.2) and saving the results in a new dataset. I would like to create my own plots from the new dataset and need to differentiate between the original estimates and those generated by the metatrim command. The new dataset contains the variable 'id' which contains string values "fill1", "fill 2" etc and "study 1", "study 2" etc. I have tried the following commands:

gen id2=id
replace id2 "filled" if id=="fill*"

which didn't work. I cannot find any reference of a wildcard being used in such a situation, is it possible? I'm sure there is a very simple solution to my problem so I apologise in advance!

Thank you for your help,


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

* For searches and help try:

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125     Fax (316) 263-0761

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index