BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Curly
Fluorite | Level 6

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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.

View solution in original post

2 REPLIES 2
Astounding
PROC Star

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.

Curly
Fluorite | Level 6

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

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 2 replies
  • 905 views
  • 0 likes
  • 2 in conversation