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 (February 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 19 Feb 2004 15:30:29 -0500
Reply-To:     diskin.dennis@KENDLE.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dennis Diskin <diskin.dennis@KENDLE.COM>
Subject:      Re: Pointer line control problem
Comments: To: Helen <sunchunkui@HOTMAIL.COM>
Content-Type: text/plain; charset="us-ascii"

Helen,

When you use the # pointer with constants, SAS is smart enough to figure out how big to make the buffer to hold all the lines you might address in on pass of the datastep, but when you use a variable, SAS does not know what values it may take on. To remedy this we have th N= option on the file statement where you specify the maximum value your index value may take on. In your second example, just use : file out print n=20; and you should be fine. Too large a value for N should not normally matter.

HTH, Dennis Diskin

Helen <sunchunkui@HOTMAIL.COM> Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> 02/19/2004 03:08 PM Please respond to Helen

To: SAS-L@LISTSERV.UGA.EDU cc: Subject: Pointer line control problem

Dear SAS-L,

I have a macro to do some report output and have line pointer control problem like the following(seems numeric-variable doesn't work):

1---the follwing codes works,and output like: column1 line1 column2 line1 column1 line2 column2 line2 column1 line3

filename out 'c:\temp\wrap test.txt';

data _null_; file out print ; /* do index=1 to 10; col='column1 line'||trim(put(index,2.)); put #index @1 col @; end;

do index=1 to 5; col='column2 line'||trim(put(index,2.)); put #index @30 col @; end;*/

index=1; put #1 @1 'column1 line1' @; index=2; put #2 @1 'column1 line2' @; index=3; put #3 @1 'column1 line3' @; index=1; put #1 @30 'column2 line1' @; index=2; put #2 @30 'column2 line2' @;

put; run;

2--When use 'index' variable ,it didn't work and result like the following: column1 line1 column1 line2 column1 line3 column2 line1 column2 line2

filename out 'c:\temp\wrap test.txt';

data _null_; file out print ; /* do index=1 to 10; col='column1 line'||trim(put(index,2.)); put #index @1 col @; end;

do index=1 to 5; col='column2 line'||trim(put(index,2.)); put #index @30 col @; end;*/

/* index=1; put #1 @1 'column1 line1' @; index=2; put #2 @1 'column1 line2' @; index=3; put #3 @1 'column1 line3' @; index=1; put #1 @30 'column2 line1' @; index=2; put #2 @30 'column2 line2' @; */ index=1; put #index @1 'column1 line1' @; index=2; put #index @1 'column1 line2' @; index=3; put #index @1 'column1 line3' @; index=1; put #index @30 'column2 line1' @; index=2; put #index @30 'column2 line2' @;

put; run;

Could someone help me here? Thanks in advance.

Helen


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