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 (June 2004, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 29 Jun 2004 11:21:27 -0400
Reply-To:     "Lustig, Roger" <roger.lustig@CITIGROUP.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Lustig, Roger" <roger.lustig@CITIGROUP.COM>
Subject:      Re: write a dataset to fiferent external files
Comments: To: Jamil Ibrahim <jibrahim@IR.UMSMED.EDU>
Content-Type: text/plain; charset="iso-8859-1"

Jamil:

CALL SYMPUT won't work, because it doesn't write out the macro value until the end of the DATA step.

Check out the FILEVAR= option in the FILE statement! Example 5 in the SAS V8 on-line docs may be what you need.

Roger

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Jamil Ibrahim Sent: Tuesday, June 29, 2004 11:06 AM To: SAS-L@LISTSERV.UGA.EDU Subject: write a dataset to fiferent external files

HI sas users : I would like to be able to write the following data set to diferent external files where each file name will begin with d and the its 2 number id; I would like for each external file to have the first 4 lines first because they are the key and its students represented by ids . the data needs to be graded by dept. each id repreents a dept. this is a sample.

options nodate nonumber; dm 'log;clear;out;clear;' ; DATA tests key studs;

input @1 name $char20. @21 id $char2. @1 data $char58.; if _n_<5 then output key;else if _n_ >4 then output studs; cards; **med 631 0908031001050110000000030nnDR abe ZZZKEY 00001 BDBDADAECBADACACADAACDAADCC ZZZPARTS AAAAAAAAAAAAAAAAAAAAAAAAAAA ZZZWEIGHTS AAAAAAAAAAAAAAAAAAAAAAAAAAA OWENS J Y 567610537 BDBDADAECBADACBCADAECEAADBC TUCKER J A 425476429 BDBDADAECBADECBCBDAACDAADCC JONES B 425339759 BDBDADAECAAAACBEEDADCBBADBC WYNN A J 587670785 BDBDADAECBADECACADABCDAADEC EVERETT S TT 425234606 ADBDADAECBADACACADAECDAADCC PAYNE WIL 426495279 BDBDABACCBADAEACADABCDAADCC AHUJA OHIT 427530286 BBBEAEAACABDACEAAAADCDCADCB LILES LANE HARDY425618482 BDBDADAECABDAEBCAAADBDAADCB SHAW THRYN 428411706 BDBDADAADBADACACBDAACDAAECC MYERS GELA M 484922825 BDBDADAACAADACACADAABDBADCC SKELTON NDON 567639960 BDBDADABCAADACACACAACDADDCC ; proc sort;by id; run; data t2;set studs end=eof;by id;idd=id; call symput('files',"D" || id); file "a:\&files" ; put @1 name $char20. @21 id $char2. @1 data $char58.; if last.id then return;

run;

Dr. Jamil M. Ibrahim, Ph.D. Institutional Research Associate Assistant Professor, SHRP The University of Mississppi Medical Center 2500 North State Street Jackson, Mississippi 39216-4505 USA Telephone: 1-(601) 984-1197 Fax:1-(601) 984-1205 INternet: jibrahim@ir.umsmed.edu


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