SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Maisha_Huq
Quartz | Level 8

Hi:

Is there a way to create an output dataset from a proc ttest?

Thank you!

5 REPLIES 5
stat_sas
Ammonite | Level 13

Put

ods output ttests=ttests;

before proc ttest

then

proc print data=ttests;

run;

Maisha_Huq
Quartz | Level 8

Thanks!  if I do a proc contents, however, it tells me that the dataset doesn't exist.  Is there no way, then, to create a data set from a proc ttest?

Is there another way to do a ttest and create an output dataset?

778  ods output ttests=ttest;

779  proc ttest data=sample_amp;

780  class control ;

781  var fns ;

782  run;

NOTE: The data set WORK.TTEST has 2 observations and 6 variables.

NOTE: PROCEDURE TTEST used (Total process time):

      real time           28.54 seconds

      cpu time            1.29 seconds

783  proc contents data =ttests varnum; run;

ERROR: File WORK.TTESTS.DATA does not exist.

NOTE: Statements not processed because of errors noted above.

NOTE: PROCEDURE CONTENTS used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

NOTE: The SAS System stopped processing this step because of errors.

PaigeMiller
Diamond | Level 26

proc contents data =ttests varnum; run;

With the code you used, the data set is named ttest and not ttests

--
Paige Miller
SteveDenham
Jade | Level 19

As Paige points out, the dataset is named ttest.

I have always found it unusual that the equals sign in the ODS OUTPUT statement works exactly the opposite to the way I was taught.  Here it assigns left to right, and I had always been taught 'right to left':  whatever is on the left hand side already exists and is assigned to the right hand side.  It still catches me at least half of the time when I am using a new table to dataset output statement.

Steve Denham

Rick_SAS
SAS Super FREQ

Steve,

Try thinking of it as akin to the syntax used to specify a data set in a SAS procedure. In the DATA= option, the OUT= option, the OUTEST= option, etc,the name of the data set is specified on the right.  It doesn't matter if the data already exist (DATA=) or if the syntax will create a new data set (OUT=).

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 24347 views
  • 4 likes
  • 5 in conversation