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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 894 views
  • 0 likes
  • 2 in conversation