BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have been doing some analysis using PROC REG.
There are some flaws to the analysis.
PROC ROBUSTREG would be the best tool to use for the analysis, except I haven't been able to find a way to get at the error and goodness of fit parameters into a datafile like you can with PROC REG.
Also, I am regressing hundreds of systems, so I have to use "noprint" as an option for PROC REG to suppress the >30,000 pages of output it tries to create. Is there a way to deal with this in PROC ROBUSTREG?
7 REPLIES 7
deleted_user
Not applicable
usually the trick is ods _all_ close; or ods select none; because some PROCs don't have the NOPRINT option.

reference: http://support.sas.com/onlinedoc/913/getDoc/en/statug.hlp/ods_sect4.htm
deleted_user
Not applicable
To get the goodness of fit info and the error statistics for the parameters, I'm trying to use PIPEs to capture the print data for parsing.

Using PIPEs is proving to be very difficult. I trying to use


signon p1 sascmd='!sascmd' wait=no signonwait=no;
rsubmit p1 wait=no ;

options source2;
filename outp namepipe '\\.\PIPE\pipe1';
...
proc printto print=outp;
...
proc printto print=print;

endrsubmit p1;

signon p2 sascmd='!sascmd';
rsubmit p2;

options source source2;

filename inp namepipe "\\.\PIPE\pipe1" client;

data retrieved;
length line $256;
infile inp;
input line $;
run;
quit;

proc print data=retrieved;
run;
quit;

endrsubmit p2;

signoff p1
signoff p2

deleted_user
Not applicable
continuing failure, stepping back even farther.

Created two test SAS programs: pipe_server_play.sas and pipe_client_play.sas
Copied the server code example from the SAS Help Filename Named Pipes document to pipe_server_play.sas
Copied the client code example to pipe_client_play.sas
Highlighted both programs in Windows Explorer, right-clicked and selected "Batch Submit with SAS 9.1"
Both ran essentially simultaneous.
Both terminated.
Both ran with out error.
Got the appropriate results in pipe_client_play.lst

Therefore, named pipes will work on my workstation.
I can eliminate that potential problem from the troubleshooting space.
deleted_user
Not applicable
wrapped the server inside an asynchronous SAS/CONNECT session, but still in a separate program.

Still works.

Important note: the asynchronous session must have a "signoff" statement for normal termination.
deleted_user
Not applicable
Put the client process in the same source file as the server.
Still working.
This is goodness, so far.

[pre]
signon p1 sascmd='!sascmd' wait=no signonwait=no;
rsubmit p1 wait=no ;

options source source2;

/* Creates a pipe called WOMEN, acting */
/* as a server. The server waits 30 */
/* seconds for a client to connect. */
filename women namepipe '\\.\pipe\women' server retry=30;
/* This code writes three records into */
/* the named pipe called WOMEN. */
data class;
input name $ sex $ age;
file women;
if upcase(sex)='F' then
put name age;
datalines;
MOORE M 15
JOHNSON F 16
DALY F 14
ROBERTS M 14
PARKER F 13
;

endrsubmit;

/* Creates a pipe called WOMEN, acting */
/* as a client. The client waits 30 */
/* seconds for a server to connect. */
filename in namepipe '\\.\pipe\women' client retry=30;

data female;
infile in;
input name $ age;
proc print;
run;

signoff p1;
endsas;
[/pre]
deleted_user
Not applicable
Don't know what I was doing wrong for the last two days, but having restarted from the bottom up from the example in the SAS documentation has worked, and I can now work on parsing the ROBUST REG output.

Here's the relevant code for posterity sake and other people to learn from.

[pre]
signon p1 sascmd='!sascmd' wait=no signonwait=no;
rsubmit p1 wait=no ;

options source source2;

filename outp namepipe '\\.\pipe\robustreg' server retry=30;
filename outp list;

data suzzyQ;
* do i = 1 to 162;
do i = 1 to 1;
* do j = 1 to 500;
do j = 1 to 1;
* do dow = 1 to 7;
do dow = 1 to 1;
do timestamp = '00:00:00't to '23:59:59't by '00:15:00't;
do x=1 to 25;
y=0.03 + (x+ranuni(0)/1000);
output;
end;
end;
end;
end;
end;
format timestamp time.;
run;

proc printto print=outp new;
run;

proc robustreg data=suzzyQ outest=_estimates_;
by i j dow timestamp;
model y=x;
output out=stuff leverage=leverage outlier=outlier p=predicted r=residual sr=sresidual stdp=stdp;
run;
quit;

proc printto print=print;
run;
quit;

filename outp clear;

endrsubmit;


filename inp namepipe '\\.\pipe\robustreg' client retry=30;
filename inp list;

data retrieved;
length ll 8 line $256;
infile inp length=l;
ll = l;
input line $varying80. ll;
line = compbl(line);
run;
quit;

proc printto print='retrieved.lst';
run;
proc print data=retrieved;
run;
proc printto print=print;
run;

signoff p1;


endsas;
[/pre]
OsoGris
SAS Employee

You can exclude the output without using a NOPRINT which disables the Output Delivery System (ODS) by bracketing your code with the folllowing two statements:

 

ODS LISTING CLOSE;

 

. . . procedure code goes here . . .

 

ODS LISTING;

 

This is the "ODS way" to do a NOPRINT.

 

Furthermore, you can use an ODS OUTPUT statement to then output any portion of the output to a SAS data set. Look under the Details => ODS Table Names in the documentation for the correct tablename, e..g. - - http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_rreg_details...

 

The syntax for an ODS OUTPUT statement, for example is:

 

ODS OUTPUT GoodFit=GF;

 

where "GoodFit" is an ODS Table Name listing in the documentation and "GF" is a SAS data set name (your choice here).  Then you can operate on the SAS data set "GF" just as you would any other SAS data set.

 

I hope that helps.

 

 

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 2836 views
  • 0 likes
  • 2 in conversation