Help using Base SAS procedures

data _NULL_

Reply
Contributor L_L
Contributor
Posts: 56

data _NULL_

Dear all,

I've this code:

PROC UNIVARIATE DATA=TEMP normal;
BY AGEGRP GENDER;
VAR SCORE1 SCORE2 SCORE3;
OUTPUT OUT=OUTSTATS N=N1 N2 N3
MEAN=MEAN1 MEAN2 MEAN3
STD=STD1 STD2 STD3
MEDIAN=MEDIAN1 MEDIAN2 MEDIAN3
NORMAL=NORMAL1 NORMAL2 NORMAL3;
RUN;

DATA _NULL_;
SET OUTSTATS ;
IF _N_=1 THEN DO;
PUT 'Table of Univariate Statistics';
PUT '--------------------------------------------------------------';
PUT @1 'Age' @8 'Gender' @16 'Measure' @26 'N' @32 'Mean'
@38 'Std Dev' @47 'Median' @55 'Normality Test';
PUT '--------------------------------------------------------------';
PUT ' ';
END;
FORMAT MEAN1-MEAN3 STD1-STD3 MEDIAN1-MEDIAN3 Z5.2 NORMAL1-NORMAL3 5.2;
IF NORMAL1<.95 THEN NTEXT1='Not Normal'; ELSE NTEXT1='Normal';
IF NORMAL2<.95 THEN NTEXT2='Not Normal'; ELSE NTEXT2='Normal';
IF NORMAL3<.95 THEN NTEXT3='Not Normal'; ELSE NTEXT3='Normal';
PUT @1 AGEGRP @8 GENDER @;
PUT @16 'Score1' @24 N1 @32 MEAN1 @40 STD1 @48 MEDIAN1 @56 NORMAL1 @64 NTEXT1;
PUT @16 'Score2' @24 N2 @32 MEAN2 @40 STD2 @48 MEDIAN2 @56 NORMAL2 @64 NTEXT2;
PUT @16 'Score3' @24 N3 @32 MEAN3 @40 STD3 @48 MEDIAN3 @56 NORMAL3 @64 NTEXT3;
PUT ' ';

RUN;

I would like to print the "results" of the data _null_ not adding the statement "file print;" but with a proc print. How can I do it?

Thanks in advance
Super Contributor
Super Contributor
Posts: 3,174

Re: data _NULL_

Suggest using the DATA step logic you have, creating a new file (or adding variables to the same input file, as preferred), then in the DATA step, assign your SAS variables based on the logic you have already coded.

The output will be a file that is suitable to use with PROC PRINT, while seeing that you will need likely to code some LABEL, FORMAT, VAR statements to replicate as close as possible your DATA step code.

Suggest you give the idea a try, then post back to the forum with a modified SAS routine for feedback/guidance, if needed.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

proc print documentation site:sas.com
Contributor L_L
Contributor
Posts: 56

Re: data _NULL_

Maybe I've to use the CALL SYMPUT, I've tried but without results..
Super User
Posts: 10,018

Re: data _NULL_

You can use proc report + line statement to stead with proc print ,If you like.


Ksharp
Occasional Contributor
Posts: 9

Re: data _NULL_

Using the "data _null_;" tells SAS that no dataset is to be created. Create the dataset ("data mydatasetSmiley Wink then you use "proc print data=mydataset;" to print it.
Ask a Question
Discussion stats
  • 4 replies
  • 336 views
  • 0 likes
  • 4 in conversation