BookmarkSubscribeRSS Feed
Mistletoad
Calcite | Level 5

Hi everyone, I am using the WRDS MACRO to calculate betas. Please find the code attached below.

 

When I run this macro on my own (without changing anything) I get the follow errors (please see attached photos). 

I am not really sure how to address the notes and errors because it is underlying things I do not see in the original code. Does anyone have any tips on what I could do?

 

2021-06-11 11_35_45-SAS Studio.png

11 REPLIES 11
Kurt_Bremser
Super User

Please COPY/PASTE the log texts into windows opened with the </> button. No need for pictures or attachments when the logs are just a handful of lines.

Mistletoad
Calcite | Level 5
 NOTE: The quoted string currently being processed has become more than 262 
       bytes long.  You might have unbalanced quotation marks.
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 2          TITLE;
 3          FOOTNOTE;
 4          OPTIONS LOCALE=en_US DFLANG=LOCALE;
 5          DATA _NULL_;
 103        &GRAPHTERM; ;*';*";*/;RUN;QUIT;
                          _________________
                          49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in 
              a future SAS release.  Inserting white space between a quoted 
              string and the succeeding identifier is recommended.
 
 6          RUN;
 7          OPTIONS VALIDVARNAME=ANY;
 8          OPTIONS VALIDMEMNAME=EXTEND;
 9          FILENAME _HTMLOUT TEMP;
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8';
 10         FILENAME _RTFOUT TEMP ENCODING='UTF-8';
                                                 __
                                                 49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in 
              a future SAS release.  Inserting white space between a quoted 
              string and the succeeding identifier is recommended.
 
 11         FILENAME _PDFOUT TEMP;
 12         FILENAME _GSFNAME TEMP;
 13         FILENAME _DATAOUT TEMP;
 14         %LET SYSCC=0;
 15         %LET _CLIENTAPP='SAS Studio';
 16         %LET _CLIENTAPPABREV=Studio;
 17         %LET _CLIENTAPPVERSION=3.81;
 18         %LET _CLIENTVERSION=3.81;
 NOTE: The quoted string currently being processed has become more than 262 
       bytes long.  You might have unbalanced quotation marks.
 19         %LET _CLIENTMODE=basic;
 20         %LET _SASSERVERNAME=%BQUOTE(localhost);
 21         %LET _SASHOSTNAME=%BQUOTE(wrds-sas9-w);
 22         %LET _SASPROGRAMFILEHOST=%BQUOTE(wrds-sas9-w);
 23         %LET _CLIENTUSERID=%BQUOTE(jyuan93);
 24         %LET _CLIENTUSERNAME=%BQUOTE(Jonathan Yuan);
 25         %LET
 25       ! CLIENTMACHINE=%BQUOTE(BRAS-BASE-OKVLON0102W-GRC-48-184-147-218-28.DSL
 25       ! .BELL.CA);
 26         %LET
 26       ! _CLIENTMACHINE=%BQUOTE(BRAS-BASE-OKVLON0102W-GRC-48-184-147-218-28.DS
 26       ! L.BELL.CA);
 27         %let SASWORKLOCATION="%sysfunc(getoption(work))/";
 28         FILENAME _CWD '.'
                            _
                            49
 28       ! ;
 NOTE 49-169: The meaning of an identifier after a quoted string might change in 
              a future SAS release.  Inserting white space between a quoted 
              string and the succeeding identifier is recommended.
 
 29         DATA _NULL_;
 30         CALL SYMPUT('_SASWORKINGDIR',PATHNAME('_CWD'));
                                       ____________
                                       49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in 
              a future SAS release.  Inserting white space between a quoted 
              string and the succeeding identifier is recommended.
 
 31         RUN;
 32         FILENAME _CWD;
 33         
 34         %LET _SASPROGRAMFILE = %NRQUOTE(%NRSTR(/home/uwaterloo/jyuan93/Pilot
 34       ! Test/Beta_test.sas));
 NOTE: The quoted string currently being processed has become more than 262 
       bytes long.  You might have unbalanced quotation marks.
 35         %LET _BASEURL =
 35       ! %BQUOTE(https://wrds-cloud.wharton.upenn.edu/SASStudio/);
 30         CALL SYMPUT('_SASWORKINGDIR',PATHNAME('_CWD'));
                                                       ____
                                                       49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in 
              a future SAS release.  Inserting white space between a quoted 
              string and the succeeding identifier is recommended.
 
 36         %LET _EXECENV=SASStudio;
 37         DATA _NULL_;
 38         CALL SYMPUT("GRAPHINIT","");
 39         CALL SYMPUT("GRAPHTERM","");
 40         RC=TSLVL('SASXGOPT','N');
 41         _ERROR_=0;
 42         IF (RC^=' ') THEN DO;
 43         CALL SYMPUT("GRAPHINIT","GOPTIONS RESET=ALL GSFNAME=_GSFNAME;");
 44         CALL SYMPUT("GRAPHTERM","GOPTIONS NOACCESSIBLE;");
 45         END;
 46         RUN;
 47         DATA _NULL_;
 48         RC=SYSPROD("PRODNUM002");
 49         IF (RC^=1) THEN DO;
 NOTE: The quoted string currently being processed has become more than 262 
       bytes long.  You might have unbalanced quotation marks.
 50         CALL SYMPUT("GRAPHINIT","");
 51         CALL SYMPUT("GRAPHTERM","");
 52         END;
 53         RUN;
 54         %LET _DATAOUT_MIME_TYPE=;
 55         %LET _DATAOUT_NAME=;
 56         %LET _DATAOUT_TABLE=;
 57         %LET _DATAOUT_URL=;
 58         %SYMDEL _DATAOUT_MIME_TYPE _DATAOUT_NAME _DATAOUT_URL _DATAOUT_TABLE;
 59         %LET _SASWS_ = %BQUOTE(/home/uwaterloo/jyuan93);
 42         IF (RC^=' ') THEN DO;
                      ___________
                      49
 NOTE 49-169: The meaning of an identifier after a quoted string might change in 
              a future SAS release.  Inserting white space between a quoted 
              string and the succeeding identifier is recommended.
 
 60         %LET
 60       ! _SASWSTEMP_=%BQUOTE(/home/uwaterloo/jyuan93/.sasstudio/.images/5ed268
 60       ! 7e-4d7d-4a1e-b927-02d7b8ddf5eb);
 61         ODS LISTING CLOSE;
 62         ODS AUTONAVIGATE OFF;
 63         ODS GRAPHICS ON;
 64         ODS HTML5 (ID=WEB) DEVICE=PNG GPATH="&_SASWSTEMP_" ENCODING=utf8
 64       ! FILE=_HTMLOUT (TITLE='Results:
 64       ! Beta_test.sas') STYLE=Htmlblue OPTIONS(BITMAP_MODE='INLINE'
                         _______________________________________      ___________
 ____________                                                                    
                         49                                           49
 49
 64       ! OUTLINE='ON' SVG_MODE='INLINE'
 64       ! CSS_PREFIX='.ods_5ed2687e-4d7d-4a1e-b927-02d7b8ddf5eb'
 64       ! BODY_ID='div_5ed2687e-4d7d-4a1e-b927-02d7b8ddf5eb' );
 NOTE 49-169: The meaning of an identifier after a quoted string might change in 
              a future SAS release.  Inserting white space between a quoted 
              string and the succeeding identifier is recommended.
 
 65         ODS RTF (ID=WEB) STYLE=Rtf FILE=_RTFOUT sasdate;
 66         ODS PDF (ID=WEB) STYLE=Pearl FILE=_PDFOUT;
 67         &GRAPHINIT;
 68         OPTIONS FIRSTOBS=1;
 69         OPTIONS OBS=MAX;
 NOTE: The quoted string currently being processed has become more than 262 
       bytes long.  You might have unbalanced quotation marks.
 70         OPTIONS DTRESET DATE NUMBER NOTES;
 71         OPTIONS NOTES STIMER SOURCE NOSYNTAXCHECK;
 72         
 73         proc printto log = junk; run;
 74         proc expand data=_crsp2 out=_crsp3 method=none;
 75         by permno;
 76         id date;
 77         convert X=X2      / transformout= (MOVUSS &WINDOW.);
 78         convert X=X       / transformout= (MOVSUM &WINDOW.);
 79         convert XY=XY     / transformout= (MOVSUM &WINDOW.);
 80         convert ret=Y     / transformout= (MOVSUM &WINDOW.);
 81         convert count=n   / transformout= (MOVSUM &WINDOW.);
 82         quit;
 83         run;
 84         proc printto; run;
 85         
 86         data &outset;
 87         set _crsp3;
 88         if n>=&MINWIN. then beta=(XY-X*Y/n) / (X2-(X**2)/n);
 89         label beta = "Stock Beta";
 90         label n = "Number of Observations used to compute Beta";
 91         drop X X2 XY Y COUNT;
 92         format beta comma8.2 ret &index percentn8.2;
 93         run;
 94         
 95         /* House Cleaning */
 96         proc sql;
 97         drop view _crsp1;
 98         drop table _crsp2, _crsp3;
 99         quit;
 100        
 101        options notes;
 102        %put #### DONE . Dataset &outset. Created! ;    %put ;
 103        
 104        %MEND BETA;
 105        
 106        
 107        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 108        ODS HTML CLOSE;
 109        &GRAPHTERM; ;*';*";*/;RUN;QUIT;
 110        QUIT;RUN;
 111        ODS HTML5 (ID=WEB) CLOSE;
 112        
 113        ODS RTF (ID=WEB) CLOSE;
 114        ODS PDF (ID=WEB) CLOSE;
 115        FILENAME _GSFNAME;
 116        DATA _NULL_;
 117        RUN;
 118        OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
 119        
Mistletoad
Calcite | Level 5

Hey KurtBremser, thanks for the help.

I went through the code and I actually dont have any single quotes. Plus, the double quotations looked balanced.

I restarted SAS and the error seems to persist.

Reeza
Super User
It looks like it may be due to some autocode that WRDS is doing but your code doesn't actually show any errors. But I also see a %MEND and no %MACRO or macro call so I think you copied and pasted wrong as well - missing some code.
Mistletoad
Calcite | Level 5

Hey Reeza, I doubled checked and the code is copied correctly.

However, is there something I can add that may help the code work?

Reeza
Super User
Can you post the log from a new session with what you think is the full code because this does not look like full code. As I mentioned, %macro/%mend always go together and you have a %MEND but no %MACRO to start your code something is very off.
Reeza
Super User

If you're not famililar with macros here's a beginner level tutorial.

 

UCLA introductory tutorial on macro variables and macros
https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/


albertsamaniego
Fluorite | Level 6

Hi! I frequently encounter this kind of error whenever I have unbalanced quotes or accidentally run a SAS macro without the %mend statement. Once I fixed my code, I was just wondering if there's a way to continue working on the same session and not start a new one? There are times when I have so many data on my work library that it would take too much of my time to open a new session and rerun all my codes.

Quentin
Super User

EG generally fixes unmatched quotes by submitting a "magic string".  You can also try submitting one yourself, e.g. submit:

 

;*';*";*/;RUN;QUIT;%mend;

I tend to submit it a few times.  If the %mend at the end generates an error, then it's a clue that your session is un-stuck.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
OnkarD11
SAS Employee

I have also came across same error you just have to reset the session by pressing F9 key.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 11 replies
  • 2108 views
  • 0 likes
  • 6 in conversation