BookmarkSubscribeRSS Feed
trbmph
Calcite | Level 5

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

NameDOBDiseaseClassification statusMMR1 DateMMR2 DatePCR resultSerology result
John Doe10/25/1986MeaslesConfirmed10/25/198710/25/1994PositivePositive

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!

7 REPLIES 7
ballardw
Super User

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.

data_null__
Jade | Level 19

Applying some of the new school functions to the old school method.


4-16-2014 6-33-12 AM.png



filename FT15F001 temp;
proc import datafile=FT15F001 out=info replace dbms=csv;
   parmcards;
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
Jane Doe,
10/25/1986,Measles,Confirmed,10/25/1987,10/25/1994,Positive,Positive
;;;;
   run;

data _null_;
  
set info;
   by name notsorted;
  
put _page_;
  
do while(1);
      length _NAME_ $32 _LABEL_ _VALUE_ $128;
     
call vnext(_name_);
      if _name_ eq: 'FIRST.' then leave;
      _label_ = vlabelx(_name_);
      _value_ = left(vvaluex(_name_));
     
put _label_ +(-1) ': ' _value_;
      end;
  
run;



SKK
Calcite | Level 5 SKK
Calcite | Level 5

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;

Ksharp
Super User

proc report also can get it and make it more beautiful .

Xia Keshan

Peter_C
Rhodochrosite | Level 12

proc forms

proc fsbrowse

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

data_null__
Jade | Level 19

you might be interested in Substituting BY Line Values in a Text String



options byline=0;
proc print noobs;
  
by name dob disease classification status mmr1 notsorted;
  
title1 j=l '#byvar1: #byval1'
         
j=l '#byvar2: #byval2'
         
j=l '#byvar3: #byval3'
         
j=l '#byvar4: #byval4'
         
j=l '#byvar5: #byval5'
         
j=l '#byvar6: #byval6';
  
var tdate mmr2 date pcr result serology;  
  
run;
options byline=1;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1178 views
  • 1 like
  • 7 in conversation