Hi,
I am trying to take my data called registry and only keep 2 variables in a new data set called simple_reg.
data Est1.simple_reg (keep = record_num test_history_complete); *take the registry file and reduce the variables;
set Est1.registry;
run;
Est1.registry has 550 observations and 1700 variables
after I do this Est1.simple_reg has 0 observations and 2 variables ( the two that I keep)
What am i missing.
This new file called Est1.simple_reg shouls have 550 observations because everyone has a record number
I have also tried...
data Est1.simple_reg (); *take the registry file and reduce the variables;
set Est1.registry;
keep mrn medical_history_complete;
run;
My best guess: You experimented with many variations of the program, trying to get it to work. In one of those variations, running the program wiped out all the data within Est1.registry. Try printing the first 10 observations, and make sure the data is still there. I'm betting that it's not.
My best guess: You experimented with many variations of the program, trying to get it to work. In one of those variations, running the program wiped out all the data within Est1.registry. Try printing the first 10 observations, and make sure the data is still there. I'm betting that it's not.
Thank you so much for helping.
I'm pretty new to Sas and I found out that when I was doing the keep statment I was running into erros because many of the other variables did not have a format and hence it wasn't reading.
I did this...
data Est1.simple_reg;
set Est1.registry ( keep = mrn history_complete);
run;
and because I was telling sas which variables to keep before sas wrote them I was able to get around that.
Again thank you for helping!!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.