Help using Base SAS procedures

Reg:Output two datasets

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 140
Accepted Solution

Reg:Output two datasets

data l;
input age  no id$;
cards;
4 1 nani
5 2   
6 3 rja
run;

data l2 l3;
set l;
if id ne " " then  output l3;
else output l2;
run;

if the id =" " then in dataset l2 is getting 0 obs but the values age and no is not blank i want the output l2

output

age  no id

5 2 


Accepted Solutions
Solution
‎11-28-2011 08:44 AM
PROC Star
Posts: 7,473

Reg:Output two datasets

Posted in reply to sas_Forum

Nothing wrong with your code!  Your problem is in creating file L .. it is only reading in two records.  Try your code with the following:

data l;

  infile cards truncover;

  input age  no id$;

  cards;

4 1 nani

5 2   

6 3 rja

run;

View solution in original post


All Replies
Solution
‎11-28-2011 08:44 AM
PROC Star
Posts: 7,473

Reg:Output two datasets

Posted in reply to sas_Forum

Nothing wrong with your code!  Your problem is in creating file L .. it is only reading in two records.  Try your code with the following:

data l;

  infile cards truncover;

  input age  no id$;

  cards;

4 1 nani

5 2   

6 3 rja

run;

🔒 This topic is solved and locked.

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

Discussion stats
  • 1 reply
  • 117 views
  • 0 likes
  • 2 in conversation