Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65050

Labeling Variables Using A Loop

$
0
0
Hi All,

I am working with a dataset that has employment data from 1969 to 2015 in different classifications (i.e. Private Employment 1969, 1970, 1971.....2015; Total Employment 1969, 1970...2015). Each of the yearly employment variables is stored in a different variable. I would like to label each variable with the correct employment classification and the correct year. So, for Private Employment I want to label all my Private Employment variables with a constant label but with the year changing so that my variable for Private Employment 1969 (p1969) is labeled "Private Employment 1969 and my private employment 2015 (p2015) is labeled "Private Employment 2015".


I have tried a couple of loops using foreach, forvalues, and setting a local macro but I can't quite get it. Does anyone have any advice on this one?

Thanks,

jack

Viewing all articles
Browse latest Browse all 65050

Trending Articles