BookmarkSubscribeRSS Feed
emaguin
Quartz | Level 8

this is a stored-up list.

1) Somewhere, i've seen that it is possible get rid of that centered output and have left justified output in the results viewer window. What was showed was the specific command that went in the syntax file. Stumbling around, i found a directory or file called options. I'm looking for a permanent fix. Do modify the options file? What option name and how done?

2) Today, i wanted to write out a text data file. In spss i'd say

write outfile='path string' var list (optional Fortran-type format specification). Nice and simple and highly controllable. I see in Cody's book how to export an excel file. Mplus, the receiving program, takes only text files. In SAS, how would i write out a text data file and, if desired, control variable formats and new lines. For example: recid y1-y50 (f4.0,2x,25f3.0/6x,25f3.0).

3) I want to export a set of frequency tables to a dataset. Based on Cody's book I used this

52 ods output bprawfreqs=OneWayFreq;
53 proc freq data=pbitems; tables dpb4-dpb16; run;

WARNING: Output 'bprawfreqs' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options
are used to produce the requested output object. For example, verify that the
NOPRINT option is not used.

So. i believe the object name is correct because i did and ODS Trace command. I assume that the file (bprawfreqs is just a sas data set and it's location is controlled by the active lib statement (Correct or not?)

I read the documentation for proc freq and see that there is an "out' subcommand for a table statement. However, as i understand the documentation what is written out to the named dataset is only the last named frequency/crosstab table in the table subcommand. That's useless and it's hard to believe that is true.

4) I want  to come back to the output export problem. Recently i was running GEE models Working through the iterations of IV variable combinations, i had a list of 26 or 27 and I had to run each combination with two different DVs. The PIs requested that i summarize the results and what they wanted to see the coefficients and their significance values. (I want to say something to head off Proc Report: The coefficients and their significance are looked at and discussed, decisions are made, and the syntax and mht files could be deleted because they served their function).  In spss i could say OMS "analysis type" select if table="coefficients" ahead of the first GEE model and OMS End after the last one. In Cody i read that i can specify ods select >object< (persist); and that will do what i want. True?

That does it for now. Thanks.

 

 

 

 

 

 

 

 

4 REPLIES 4
Reeza
Super User

This blog post will help answer Questions 3/4

https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html

 

Q2:

I usually recommend using PROC EXPORT to get the structure of code needed - printed to the log and then customize as needed. 

https://documentation.sas.com/?docsetId=proc&docsetTarget=n0jcjrzsseiw2qn1gi12k645u75y.htm&docsetVer...

 

 

Q3:

The code is slightly backwards, you reversed the table name and the name of the output data set. It should be:

 

*incorrect;
ods output bprawfreqs=OneWayFreq;

*correct;
ods output OneWayFreq = bprawfreqs;

 

No idea what you mean with Q1. 

FYI - its likely significantly easier to answer your questions if you take some time to format them and to post them separately unless they're related like 3/4. 

 


@emaguin wrote:

this is a stored-up list.

1) Somewhere, i've seen that it is possible get rid of that centered output and have left justified output in the results viewer window. What was showed was the specific command that went in the syntax file. Stumbling around, i found a directory or file called options. I'm looking for a permanent fix. Do modify the options file? What option name and how done?

2) Today, i wanted to write out a text data file. In spss i'd say

write outfile='path string' var list (optional Fortran-type format specification). Nice and simple and highly controllable. I see in Cody's book how to export an excel file. Mplus, the receiving program, takes only text files. In SAS, how would i write out a text data file and, if desired, control variable formats and new lines. For example: recid y1-y50 (f4.0,2x,25f3.0/6x,25f3.0).

3) I want to export a set of frequency tables to a dataset. Based on Cody's book I used this

52 ods output bprawfreqs=OneWayFreq;
53 proc freq data=pbitems; tables dpb4-dpb16; run;

WARNING: Output 'bprawfreqs' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options
are used to produce the requested output object. For example, verify that the
NOPRINT option is not used.

So. i believe the object name is correct because i did and ODS Trace command. I assume that the file (bprawfreqs is just a sas data set and it's location is controlled by the active lib statement (Correct or not?)

I read the documentation for proc freq and see that there is an "out' subcommand for a table statement. However, as i understand the documentation what is written out to the named dataset is only the last named frequency/crosstab table in the table subcommand. That's useless and it's hard to believe that is true.

4) I want  to come back to the output export problem. Recently i was running GEE models Working through the iterations of IV variable combinations, i had a list of 26 or 27 and I had to run each combination with two different DVs. The PIs requested that i summarize the results and what they wanted to see the coefficients and their significance values. (I want to say something to head off Proc Report: The coefficients and their significance are looked at and discussed, decisions are made, and the syntax and mht files could be deleted because they served their function).  In spss i could say OMS "analysis type" select if table="coefficients" ahead of the first GEE model and OMS End after the last one. In Cody i read that i can specify ods select >object< (persist); and that will do what i want. True?

That does it for now. Thanks.

 

 


 

SASKiwi
PROC Star

With question 1 try this SAS option: options nocenter;

Tom
Super User Tom
Super User

Are you looking for the CENTER/NOCENTER option?

Just include it in your autoexec.

options nocenter;
Tom
Super User Tom
Super User

If you want to write a text file use the PUT statement.  If you want to use a "FORTRAN like format list" then () in around the variable names and separate () around the formats.

data _null_;
  set HAVE ;
  file 'myfile';
  put (varlist) (fmtlist);
run;

To write a delimited file use the DSD option.  No need to for formats so just list the variables.

data _null_;
  set HAVE ;
  file 'myfile' dsd ;
  put varlist ;
run;

If you want to list all of them you can use the _ALL_ keyword, but then you need to use the () or else it writes name=value instead and includes automatic variables like _N_.  No need to list formats, but you need to put something in the format list so use a pointer control like +0 or a modifier like : .

  put (_all_) (+0);

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 460 views
  • 0 likes
  • 4 in conversation