LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 8 Nov 2004 15:00:55 -0700
Reply-To:   Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Subject:   Re: PROC inside PROC
Comments:   To: Toby.Dunn@TEA.STATE.TX.US
Content-Type:   text/plain; charset=us-ascii

The log doesn't show that the PROC DATASETS are running inside PROC REPORT. It shows that they're running *after* PROC REPORT.

I think you're confused by the value of the macro variable COUNT being printed as expected. But if you review the documentation for CALL EXECUTE, you'll see that *macro* statements ("%let count...") are executed immediately, but SAS statements ("proc datasets...") are executed after the next step boundary.

-- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA

>>> "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US> 11/08/2004 1:28 PM >>> To reply to all those who said it actually isn't running a proc inside a proc run the following code, look at the log:

%symdel count;

data test1; x = 1; run; data test2; x = 1; run; data test3; x = 1; run;

data foo; retain data 0; do pt=10 to 1 by -1; drug="ABC"; do visit=1 to 3; data+1; output; end; end; do pt=20 to 11 by -1; drug="DEF"; do visit=3 to 1 by -1; data+1; output; end; end; run;

%let count = 0;

proc report data=foo nowd headline; column drug pt temp visit data; define drug / order order=internal noprint; define pt / order order=internal; define temp / computed 'drug'; define visit / order order=internal; define data / display width=20;

compute temp / char; temp = drug; endcomp;

rbreak after / page;

compute after _page_;

call execute('%let count = %eval(&count + 1);'); call execute('proc datasets; delete test&count; run;');

test = symget('count'); line 'current page number is: ' test $20.; endcomp;

run;

%put total pages in report &count;

Toby Dunn

-----Original Message----- From: Ed Heaton [mailto:EdHeaton@westat.com] Sent: Monday, November 08, 2004 3:22 PM To: Dunn, Toby Subject: RE: PROC inside PROC

Toby,

Might I dare to suggest that your PROC DATASETS actually runs after the PROC REPORT. Yes, in the PROC REPORT you suggested to SAS that it should run PROC DATASETS. But the commands from CALL EXECUTE typically run after the step where CALL EXECUTE is specified.

Ed

Edward Heaton, SAS Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1600 Research Boulevard, RW-3541, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 610-5128 mailto:EdHeaton@Westat.com http://www.Westat.com

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Dunn, Toby Sent: Monday, November 08, 2004 3:15 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: PROC inside PROC

I am running it on windows XP v9.1.2

Here is the code that I used:

%symdel count;

data foo; retain data 0; do pt=10 to 1 by -1; drug="ABC"; do visit=1 to 3; data+1; output; end; end; do pt=20 to 11 by -1; drug="DEF"; do visit=3 to 1 by -1; data+1; output; end; end; run;

%let count = 0; proc report data=foo nowd headline; column drug pt temp visit data; define drug / order order=internal noprint; define pt / order order=internal; define temp / computed 'drug'; define visit / order order=internal; define data / display width=20;

compute temp / char; temp = drug; endcomp;

rbreak after / page; compute after; call execute('proc datasets; run;'); endcomp;

compute after _page_; call execute('%let count = %eval(&count + 1);'); test = symget('count'); line 'current page number is: ' test $20.; endcomp;

run;

%put total pages in report &count;

Toby Dunn

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Jack Hamilton Sent: Monday, November 08, 2004 1:48 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: PROC inside PROC

How did you run a PROC DATASETS inside a PROC REPORT?

It might be possible in version 9 with pipelined data streams, but that's not in version 8.

-- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA

>>> "Dunn, Toby" <Toby.Dunn@TEA.STATE.TX.US> 11/08/2004 11:15 AM >>> The short answer is sometimes. I have run a proc datasets inside a a proc report. So yes sometimes you can and other times you can't. The reason for the proc report is due to how it creates the report.

You will just have to monkey around with it but don't be too surprised if it won't work for your proc.

Toby Dunn

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Arvind Chande Sent: Sunday, November 07, 2004 11:08 PM To: SAS-L@LISTSERV.UGA.EDU Subject: PROC inside PROC

Can we use procedures inside the other procedure? If yes, does anyone has an example?

In PROC GA this is very useful to reduce the time of operation. Also, the other problem in PROC GA is internal operations are carried out on the arrays or variables individually and not on the record. Does anybody has sorted out this problem?

"MMS <firsthealth.com>" made the following annotations. ------------------------------------------------------------------------ ------ This message, including any attachments, is intended solely for the use of the named recipient(s) and may contain confidential and/or privileged information. Any unauthorized review, use, disclosure or distribution of this communication(s) is expressly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy any and all copies of the original message. Thank you. ======================================================================= ======


Back to: Top of message | Previous page | Main SAS-L page