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 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 16 Jun 2008 02:51:23 -0700
Reply-To:     karma <dorjetarap@GOOGLEMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         karma <dorjetarap@GOOGLEMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: Using datalines to create a dataset in macro in SAS 9.0
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On 16 Jun, 09:44, murugesh <iammurug...@gmail.com> wrote: > Hi sas-user, > Any one can solve this problem.. > > options mprint mlogic; > %macro s(); > %let mth = %sysfunc(intnx(month,"01APR06"d,1), monyy.); > %put &mth; > data A&mth.; > input unique_id :$8. runmonth :$8. ; > datalines; > muru sas > ; > run; > > %mend s; > %s;

Hi Murugesh,

You cant use cards or datalines within a macro. This one tripped me up before too, till the folk on this forum gave me some solutions. You can try one of the following to get around this:

%macro test1 ; /* this is okay for small datasets */ data test ; a = 1 ; b = 2 ; c = 3 ; OUTPUT ; a = 4 ; b = 5 ; c = 6 ; OUTPUT ; a = 7 ; b = 8 ; c = 9 ; OUTPUT ; run; %mend test1;

%test1;

%macro test2 ; /* This macro reads an external file. For larger datasets */ filename ext_file "c:\My Documents\test.txt" ; data test ; infile ext_file ; input a b c ; run;

%mend test2 ;

%test2;


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