BookmarkSubscribeRSS Feed
MisoLee
Calcite | Level 5

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!

4 REPLIES 4
Reeza
Super User

Why are those variables in your length statement?

OS2Rules
Obsidian | Level 7

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.

ballardw
Super User

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..

MisoLee
Calcite | Level 5

I figured it out now. Thank everyone for your help!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 887 views
  • 2 likes
  • 4 in conversation