BookmarkSubscribeRSS Feed
L_L
Calcite | Level 5 L_L
Calcite | Level 5
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
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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
L_L
Calcite | Level 5 L_L
Calcite | Level 5
Maybe I've to use the CALL SYMPUT, I've tried but without results..
Ksharp
Super User
You can use proc report + line statement to stead with proc print ,If you like.


Ksharp
jj030655
Calcite | Level 5
Using the "data _null_;" tells SAS that no dataset is to be created. Create the dataset ("data mydataset;) then you use "proc print data=mydataset;" to print it.

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!

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.

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
  • 4 replies
  • 1334 views
  • 0 likes
  • 4 in conversation