I have a line list of cases that includes information like name, DOB, date of symptom onset, vaccination status, classification status, lab results, etc. I wan to take this information and get a print out of each of these fields per person with one person on each page. For example:
This
Name | DOB | Disease | Classification status | MMR1 Date | MMR2 Date | PCR result | Serology result |
---|---|---|---|---|---|---|---|
John Doe | 10/25/1986 | Measles | Confirmed | 10/25/1987 | 10/25/1994 | Positive | Positive |
Becomes this
Name: John Doe
DOB: 10/25/1986
Disease: Measles
Classification status: Confirmed
etc...
Having the column label in front of each value listed would be nice but not necessary. I can transpose data but this will not give me one page per person. Any ideas?
Thanks!
A very old school approach that may get you started:
data _null_;
file "C:\path\myfilename.txt";
set yourdatset;
put "Name: " name /
"DOB: " dob /
"Disease: " disease ;
put _page_;
run;
You want to specify the path and name to somewhere you like. This creates a basic text document such as Notepad or other text editor can use.
Applying some of the new school functions to the old school method.
Hi,
If you want to create a dataset this might help you-
PROC transpose data=Have out=want ;
VAR name DOB Disease Classification_status .... ;
BY name;
RUN;
If you want to create a report with one subject per page try this-
I have used ODS statement to create a PDF report,
ods pdf file="\Report.pdf";
proc print data=new noobs;
by name notsorted;
pageby name;
run;
ods pdf close;
proc report also can get it and make it more beautiful .
Xia Keshan
proc forms
proc fsbrowse
How about (and yes, you are limited to 10 titles, though with split char/rtf codes etc. you can make more):
data have;
attrib Name DOB Disease Classification status MMR1 TDate MMR2 Date PCR result Serology result format=$20.;
infile datalines delimiter=',' missover;
input Name $ DOB $ Disease $ Classification $ status $ MMR1 $ TDate $ MMR2 $ Date $ PCR $ result $ Serology $ result;
datalines;
John Doe,10/25/1986,Measles,Skin,Confirmed,10/25/1987,10/25/1994,Positive,Positive,01/01/2013,AAA,1234,Positive,112233
John Doe,10/25/1986,Measles,Skin,Confirmed,10/25/1987,10/25/1994,Positive,Negative,02/01/2013,ABA,44234,Positive,445566
;
run;
proc sql;
create table LOOP as
select distinct
NAME,
DOB,
DISEASE,
CLASSIFICATION,
STATUS,
MMR1
from WORK.HAVE;
quit;
ods _all_ close;
ods pdf file="s:\temp\rob\test.pdf" style=statistical;
data _null_;
set loop;
call execute('title1 j=l "Name: '||strip(name)||'";
title2 j=l "DOB: '||strip(dob)||'";
title3 j=l "Disease: '||strip(disease)||'";
title4 j=l "Classification: '||strip(classification)||'";
title5 j=l "Status: '||strip(status)||'";
title6 j=l "MMR1: '||strip(mmr1)||'";');
call execute('proc print data=have (where=(name="'||strip(name)||'")) noobs;
var tdate mmr2 date pcr result serology;
run;');
run;
ods _all_ close;
you might be interested in Substituting BY Line Values in a Text String
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.