Hi!
I am trying to create 7 new data sets from 2004 to 2010. Then I hope to merge them into one. The result for the first data (i.e. 2004) is fine. But from 2005, the log shows weird results as the attachment. So my questions are:
(1) why did it mention variable PERWT04F is uninitialized while my commands are dealing with PERWT05F
(2) why there are 35 variables in the first part of commands but only 27 variables left after the second part of command
Thank you!
Why are those variables in your length statement?
Hi:
Firstly, from your log your second data table has the same name as the first and the SET statement is for the same table. I think you need to change the names of each of your tables to something like DATA MEPS05, for the first, DATA MEPS06 for the second. and so on. also each table should have the same set (source table).
Then use:
WHERE YEAR=2005; for the first,.
WHERE YEAR=2006; for the second,
etc.
MisoLee wrote:
Hi!
(1) why did it mention variable PERWT04F is uninitialized while my commands are dealing with PERWT05F
The variables reported as uninitialized are appearing in your length statement, so they are created. They are not initialized because 1) the dataset in the set statement does not contain them and 2) you do not assign a value to them.
The number of variables differes because some of the variables created by the length statement exist in the data set and match the Keep list but not in the first data step. In the first date step you have keep variables with 05 in the name that will not appear in the second data set because they were not on the keep statement of the second..
I figured it out now. Thank everyone for your help!!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.