BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vidyasagar1
Obsidian | Level 7
DATA HAVE;
 INFILE DATALINES;
 INPUT @1 SUP $6. @8 REC 1. @10 ERR 1. @12 DATE $8. @21 E_C $1. @23 R_C $2. @26 C_A $2. 
 @29 P_A $2. @32 S_C $2. @35 E_D $2.;
 DATALINES;
AAAAAA 9 0 1/1/2020 Y NA NA NA NA NA
AAAAAA 8 2 2/1/2020 Y NA NA NA NA NA
AAAAAA 7 5 3/1/2020 Y NA NA NA NA NA
BBBBBB 8 3 1/1/2020 N NA NA NA NA NA
BBBBBB 6 5 2/1/2020 N NA NA NA NA NA
BBBBBB 8 7 3/1/2020 N NA NA NA NA NA
CCCCCC 8 2 1/1/2020						
CCCCCC 2 1 2/1/2020						
CCCCCC 3 1 3/1/2020						
DDDDDD 9 3 1/1/2020						
DDDDDD 6 2 2/1/2020						
;
RUN;

Anyone please help me to get the output like below with the above data using PROC REPORT.

 

vidyasagar1_0-1592499551219.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
DATA HAVE;
 INFILE DATALINES;
 INPUT @1 SUP $6. @8 REC 1. @10 ERR 1. @12 DATE $8. @21 E_C $1. @23 R_C $2. @26 C_A $2. 
 @29 P_A $2. @32 S_C $2. @35 E_D $2.;
 DATALINES;
AAAAAA 9 0 1/1/2020 Y NA NA NA NA NA
AAAAAA 8 2 2/1/2020 Y NA NA NA NA NA
AAAAAA 7 5 3/1/2020 Y NA NA NA NA NA
BBBBBB 8 3 1/1/2020 N NA NA NA NA NA
BBBBBB 6 5 2/1/2020 N NA NA NA NA NA
BBBBBB 8 7 3/1/2020 N NA NA NA NA NA
CCCCCC 8 2 1/1/2020						
CCCCCC 2 1 2/1/2020						
CCCCCC 3 1 3/1/2020						
DDDDDD 9 3 1/1/2020						
DDDDDD 6 2 2/1/2020						
;
RUN;


proc report data=have nowd;
columns sup date,(rec err) e_c r_c c_a;
define sup/group;
define e_c/group missing;
define r_c/group missing;
define c_a/group missing;
define date/across;
run;

View solution in original post

3 REPLIES 3
vidyasagar1
Obsidian | Level 7
Using the below code but not getting the desired output.

PROC REPORT DATA=HAVE out=WANT nowd;
COLUMN SUP DATE,(REC ERR ) E_C R_C C_A P_A S_C E_D;
DEFINE SUP / group order=data;
DEFINE DATE / ACROSS ;
RUN;
Ksharp
Super User
DATA HAVE;
 INFILE DATALINES;
 INPUT @1 SUP $6. @8 REC 1. @10 ERR 1. @12 DATE $8. @21 E_C $1. @23 R_C $2. @26 C_A $2. 
 @29 P_A $2. @32 S_C $2. @35 E_D $2.;
 DATALINES;
AAAAAA 9 0 1/1/2020 Y NA NA NA NA NA
AAAAAA 8 2 2/1/2020 Y NA NA NA NA NA
AAAAAA 7 5 3/1/2020 Y NA NA NA NA NA
BBBBBB 8 3 1/1/2020 N NA NA NA NA NA
BBBBBB 6 5 2/1/2020 N NA NA NA NA NA
BBBBBB 8 7 3/1/2020 N NA NA NA NA NA
CCCCCC 8 2 1/1/2020						
CCCCCC 2 1 2/1/2020						
CCCCCC 3 1 3/1/2020						
DDDDDD 9 3 1/1/2020						
DDDDDD 6 2 2/1/2020						
;
RUN;


proc report data=have nowd;
columns sup date,(rec err) e_c r_c c_a;
define sup/group;
define e_c/group missing;
define r_c/group missing;
define c_a/group missing;
define date/across;
run;
vidyasagar1
Obsidian | Level 7
Thank you .. 🙂
The code is working to get the desired output..

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 786 views
  • 0 likes
  • 2 in conversation