{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lesson08 - Lesson 8 Topics Creating SAS datasets from...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Lesson 8 - Topics Creating SAS datasets from procedures Using several data steps to make reports Using PROC RANK Programs 15-16 in course notes C &S 4:D-E,G-J LSB 4:10;5:3
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Making SAS Datasets From Procedures Output from SAS PROCs can be put into SAS datasets: 1. To do further processing of the information from the output 2. To reformat output to make a report 3. To restructure original SAS dataset or create new variables
Image of page 2
Ways to Put Output into SAS Datasets Using OUTPUT statement available from many procedures Using ODS OUTPUT statement – any piece of output can be put into a SAS dataset
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Report We Want to Generate Quartiles of Weight by Gender and Center sex clinic N P25 P50 P75 Male A 9 180.0 190.0 208.0 Male B 16 158.3 174.8 218.3 Male C 29 178.0 199.5 220.5 Male D 11 172.0 184.5 194.0 Female A 6 125.0 143.5 160.5 Female B 9 150.0 164.5 184.0 Female C 6 132.5 134.3 138.5 Female D 6 131.0 137.5 148.5
Image of page 4
Program 15 LIBNAME class ‘C:\SAS_Files' ; PROC FORMAT ; VALUE sexfmt 1 = 'Male' 2 = 'Female' ; * Will use SAS dataset version of TOMHS data; DATA wt; SET class.tomhsp ( KEEP =ptid clinic sex wtbl wt12); wtchg = wt12 - wtbl; FORMAT sex sexfmt. ; RUN ;
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Create report by sex and clinic of univariate info; PROC SORT DATA = wt; BY sex clinic; PROC UNIVARIATE DATA = wt NOPRINT ; BY sex clinic; VAR wt12 ; OUTPUT OUT =univinfo N = n Q1 = p25 MEDIAN = p50 Q3 = P75 ; Dataset univinfo will have one observation for each combination of sex and clinic. Statistic name = variable name Name of new dataset
Image of page 6
PROC PRINT DATA = univinfo; RUN ; Obs sex clinic n p75 p50 p25 1 Male A 9 208.00 190.00 180.00 2 Male B 16 218.25 174.75 158.25 3 Male C 29 220.50 199.50 178.00 4 Male D 11 194.00 184.50 172.00 5 Female A 6 160.50 143.50 125.00 6 Female B 9 184.00 164.50 150.00 7 Female C 6 138.50 134.25 132.50 8 Female D 6 148.50 137.50 131.00
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
PROC PRINT DATA = univinfo NOOBS ; VAR sex clinic n p25 p50 p75; FORMAT p25 p50 p75 6.1 ; TITLE 'Quartiles of Weight by Gender/Center' ; RUN ; Quartiles of Weight by Gender and Center sex clinic N P25 P50 P75 Male A 9 180.0 190.0 208.0 Male B 16 158.3 174.8 218.3 Male C 29 178.0 199.5 220.5 Male D 11 172.0 184.5 194.0 Female A 6 125.0 143.5 160.5 Female B 9 150.0 164.5 184.0 Female C 6 132.5 134.3 138.5 Female D 6 131.0 137.5 148.5
Image of page 8
ODS TRACE ON / LISTING ;
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern