Hi all, I have a simple question. Say I want to process filenames or variable names with consecutive numbers such like "abc1xyz", "abc2xyz", "abc3xyz", "abc4xyz", ... , "abc100xyz", so I need to generate a local list of these names. Directly using local list "abc1xyz......" makes the code be too long if there are too many consecutive numbers, so I would like to ask if there is any simple way to generate local list with consecutive numbers like this? Many thanks in advance!
PS: I know that if I want to do loop. I can use forvalues x=1/100 and if I want to keep or drop variables I can use keep abc*xyz. But still, sometimes I need the list, for example when I need to keep variables with odd numbers in this list "abc1xyz", "abc2xyz", "abc3xyz", "abc4xyz", ... , "abc100xyz".
Related Posts with How to generate a local list with numbers in a simple way
How to randomly sampling and regression, and save the output 500 times, and draw kdensity of 500 coeffients?for example, I have a sample of 2000 students from 50 schools. I want to randomly drop 2 schools an…
Get rid of the space after the leading quote?Hi all, Please see the graph below and the example codes. In the 'note' option in my codes, I have …
Reformatting datasetHello Statalists, I'm new to Statalist, I've read the forum guidance and tried to follow but please…
Create new dummy variableHi everyone, I am trying to create a new dummy variable named DIS2 which defines a participant as h…
expand data and more calculation.Dear All, I found this question here (in Chinese). The raw data set is: Code: * Example generated b…
Subscribe to:
Post Comments (Atom)
0 Response to How to generate a local list with numbers in a simple way
Post a Comment