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 (December 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 10 Dec 2001 17:18:25 +0100
Reply-To:   Peter Crawford <peter.crawford@DB.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Crawford <peter.crawford@DB.COM>
Subject:   Antwort: Alternative to CARDS; in a macro?
Comments:   To: Michael Friendly <friendly@HOTSPUR.PSYCH.YORKU.CA>
Content-type:   text/plain; charset=iso-8859-1

why have you rejected using multiple %let statements or even one macro variable holding the whole list %let cards = hujkl uio 4567 jkl 90 <y x > 567 rtz ghj bnm 89 tz 345 ;

A data step (and/or macro processing) could parse those constants data parameters; retain cards "&cards" ; array parm(21) $8; do i = 1 to dim(parm); parm(i) = %scan( cards, i ); end; output ; stop; run;

You would know how many parameters you want to extract from those "CARDS"

Good luck Peter Crawford

Datum: 10.12.2001 16:56 An: SAS-L@LISTSERV.UGA.EDU

Antwort an: Michael Friendly <friendly@HOTSPUR.PSYCH.YORKU.CA>

Betreff: Alternative to CARDS; in a macro? Nachrichtentext:

I'm writing a macro which needs a data set containing constant information of labels and other control variables. Normally, I would put this in a datastep, using CARDS; (or DATALINES;), but these can't be used inside a macro.

One alternative is to put this information in a separate file, and read it with an INFILE statement, but then the macro is not self-contained, and I need to worry about how to reference the external file on different operating systems.

Another alternative is to construct a data set with a long series of assignment and output statements, e.g.,

data control; _name_='N'; label='Sample size'; type='a0'; .... output; _name_='NPARM'; label='Number of parameters'; type='a0'; .... output; ...

But, this is really tedious and ugly. Is there anything simpler I've overlooked?

thx,

-- Michael Friendly Email: friendly@yorku.ca (NeXTmail OK) Psychology Dept York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html Toronto, ONT M3J 1P3 CANADA

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


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