LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 4 Mar 2002 21:54:42 +0000
Reply-To:   Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Organization:   Crawford Software Consultancy Limited
Subject:   Re: tip: copy structure

Fehd, Ronald J. <rjf2@CDC.GOV> writes >while polishing my (in)famous 800-lb gorilla/800-line program >I saw that it would make debugging immensely easier >if I copied structures from the library members soon to be appended to. > >DATA XY;X = 1;Y=2;OUTPUT;STOP; >DATA YX;Y = 1;X=2;OUTPUT;STOP; >DATA XYZ; >if 0 then set XY;%*copy structure; > %*(obs=0) not needed; >set YX; >PROC PRINT data = XYZ; >RUN; > >commentary? > >Ron Fehd the macro maven CDC Atlanta GA USA >

If "copy structure" is part of a larger data step process, then it may be appropriate. However, I think the remainder of the process may provide more constraint. If you expect to have a %copy_structure(fromDS) macro, it needs little more than %macro copy_structure( fromDS ) ; %if %sysfunc( exist( &fromDS )) %then %do; set &fromDS( obs=0 ) ; %end; %else do; %put MACRO_&sysMacroName_ERROR: attempt use &fromDS does not exist; %end; %mend copy_structure ;

However, you may wish to control the errors that will occur if a where statement is in effect, which refers to variables that are not present in &fromDS.

-- Peter Crawford

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