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 (January 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 20 Jan 1997 11:12:00 -0500
Reply-To:     Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@RMAIL.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@RMAIL.COM
Subject:      Re: filename ref to a variable....
Comments: To: owner-LISTSERV@VTVM1.CC.VT.EDU
Content-type: text/plain; charset=US-ASCII

New Text Item: filename ref to a variable....

Douglas,

Here's how I do it.

Dave

/*** Generate Test Data ***/ data a; array a(4) $8 ('Dave', 'Joe', 'Mary', 'Sue'); array b(4) $10 ('Reading','Ryting','Rithmatic','Recess'); do i=1 to 4; do j=1 to 4; name=a(i); class=b(j); keep name class; output; end; end; run;

/*** Sort by Name ***/ proc sort; by name; run;

/*** Here's the Code ***/ data _null_; set a; by name; if first.name then call execute ('data _null_; file ' || compress(' ''c:\test\'||name||' '' lrecl=255;')); call execute('put '||quote(class)|| ';');

/*** Requires Two RUN statements ***/ run; run;

______________________________ Reply Separator ____________________________ _____ Subject: filename ref to a variable.... Author: owner-LISTSERV@VTVM1.CC.VT.EDU@INTERNET at RDNOTES Date: 1/17/97 1:35 PM

(Embedded image moved to file: PIC001.PCX) Would someone send me an example on how to assign a filename to the variable in a data step? The purpose of what I want is to fille the file with the list of classes the teacher is teaching and have the file contain a list of classes. ie: say jones is teaching precalculus, calculus 124 and multivaried calculus then h:\classes\jones contains: precalculus calculus 124 multivaried calculus

something like this seems reasonable but filename doesn't like "||"

ie: data _null_; set temp(keep=name class); by name; if first.name then do; filename nfile "h:\classes\"||name; file nfile lrecl=255; end; put class; run;

thanks for your input!!!

dn

-------------------------------------------------------------- Douglas Nichols dnichols@fhcrc.org -------------------------------------------------------------- Fred Hutchinson Cancer Research Center National Wilms Tumor Study Group Seattle, WA -------------------------------------------------------------- SMTPOriginator: owner-sas-l@VM.MARIST.EDU


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