From: Amar Mundankar on 13 Jul 2010 06:02 Hi all, Below is an extract from SAS Publication: SAS Certification Prep Guide: Advanced Programming for SAS 9. Page No. 300 ************************************************** Suppose you want to verify the value of the macro variable city. Since the %PUT statement resolves macro references in text before writing text to the SAS log, you can use it to show the stored value of city. %put The value of the macro variable CITY is: &city; Table 9.3 SAS Log 120 %put The value of the macro variable CITY is &city;: The value of the macro variable CITY is: Dallas You can also simply submit the statement &put &city; without any additional text. This statement will write the resolved value of the macro variable city to the SAS log; however, it will not write any additional text to the log. You might find that it is a good idea to add explanatory text to your %PUT statements in order to maintain clarity in the SAS log. *********************************************** It is mentioned that "You can also simply submit the statement &put &city; without any additional text.". But when I tried to write &put &city. (City has value Pune). SAS threw an error: 14 %let city = Pune; 15 %put _user_; GLOBAL CITY Pune 16 &put &city; - 180 WARNING: Apparent symbolic reference PUT not resolved. ERROR 180-322: Statement is not valid or it is used out of proper order. Can anyone please tell me can we use &put &city; to display the value of City macro variable ??? Is there any option we need to set for &put &city; so that City's value will be displayed in Log? Thanks and Regards, Amar Mundankar.
From: Patrick on 13 Jul 2010 07:01 Hi Amar SAS macro statements start with a '%', macro variables with a '&' It's therefore %put &city; as in the Cert Prep and not &put &city; You used an & before 'put' so SAS interpretes this as a macro variable - which you didn't define - and therefore the Warning "WARNING: Apparent symbolic reference PUT not resolved." HTH Patrick
|
Pages: 1 Prev: Simple Hack To Get $2000 To Your PayPal Account Next: Proc Document |