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

st: Automating generation of new vars from coordinated groups ofinput vars.


From   Clare L Maxwell <[email protected]>
To   [email protected]
Subject   st: Automating generation of new vars from coordinated groups ofinput vars.
Date   Thu, 17 Nov 2005 21:23:22 -0600

I have lots of dates I would like to calculate from month, day and year variables. It is a repetative task, and I would like to find a way to automate it so that I would not have to write a gen command for each group of variables. Below is a partial list:

"day" variables: vday bday hivday cd4day rnday
hxday1 hxday2 bgday1 bgday2 endday1 endday2
lpday1 lpday2 cbday1 cbday2 ceday1 ceday2
"month" variables: vmo bmo hivmo cd4mo rnmo
hxmo1 hxmo2 bgmo1 bgmo2 endmo1 endmo2
lpmo1 lpmo2 cbmo1 cbmo2 cemo1 cemo2
"year" variables: vyr byr hivyr cd4yr rnyr
hxyr1 hxyr2 bgyr1 bgyr2 endyr1 endyr2
lpyr1 lpyr2 cbyr1 cbyr2 ceyr1 ceyr2
new "date" variables: vdate bdate hivdt cd4dt rndt
hxdt1 hxdt2 bgdt1 bgdt2 enddt1 enddt2
lpdt1 lpdt2 cbdt1 cbdt2 cedt1 cedt2

Goal: compute dates from all these month, day and year variables without writing a gen command for each set.

I have more complicated repetative tasks that also use coordinated groups of variables. This seemed simplest to explain. I hope if I find a way to deal with the dates, I will be able to generalize it to similar repetative situations.

Thank you very much in advance for your help.

Yours truly,
Clare Maxwell
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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