SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

no observations are copied when I use data keep

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

no observations are copied when I use data keep

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;


Accepted Solutions
Solution
‎03-01-2017 03:00 PM
Super User
Posts: 5,497

Re: no observations are copied when I use data keep

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


All Replies
Solution
‎03-01-2017 03:00 PM
Super User
Posts: 5,497

Re: no observations are copied when I use data keep

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.

Occasional Contributor
Posts: 8

Re: no observations are copied when I use data keep

Posted in reply to Astounding

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

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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