<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Macro Issue - Unbalanced Quotes and White Space in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617785#M181096</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Maybe that is the issue!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pardon my ignorance but how exactly do I "call" the macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To clarify, you are saying that I provided code that makes up the macro, but I'm never actually submitting code to say "run this macro"?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes.&amp;nbsp; To define a macro use %MACRO statement and %MEND statement.&amp;nbsp; To call the macro just use % and the name of the macro.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymacro(dsn);
proc print data=&amp;amp;dsn.; run;
%mend mymacro;

%mymacro(dsn=sashelp.class(obs=3));
%mymacro(dsn=sashelp.cars(obs=3));&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 16 Jan 2020 15:15:35 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-01-16T15:15:35Z</dc:date>
    <item>
      <title>Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617760#M181083</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to run the attached code, however it doesn't actually do anything. It runs but everything is basically greyed out, like its reading only comments and not actual steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get two errors but I'm not exactly sure how to fix them since I don't see quotes anywhere in the code to even begin fixing it.&lt;/P&gt;
&lt;UL&gt;
&lt;LI id="sasLogNote1_1579184546057" class="sasNote"&gt;NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation&lt;/LI&gt;
&lt;LI class="sasNote"&gt;
&lt;DIV id="sasLogNote2_1579184546057" class="sasNote"&gt;NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space&lt;/DIV&gt;
&lt;DIV class="sasNote"&gt;between a quoted string and the succeeding identifier is recommended.&lt;/DIV&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;PRE id="pre_sasLog_6580" class="sasLog" style="background-color: transparent; -webkit-user-select: text; -webkit-user-modify: read-only; -webkit-touch-callout: default; border-top-width: 0px; border-bottom-width: 0px;"&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV class="sasNote"&gt;marks.&lt;/DIV&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;PRE id="pre_sasLog_6580" class="sasLog" style="background-color: transparent; -webkit-user-select: text; -webkit-user-modify: read-only; -webkit-touch-callout: default; border-top-width: 0px; border-bottom-width: 0px;"&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas would be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code is attached for your review!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 14:30:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617760#M181083</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-01-16T14:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617770#M181087</link>
      <description>&lt;P&gt;All you attached was a macro definition.&amp;nbsp; There was no code to actually run anything.&lt;/P&gt;
&lt;P&gt;Are you getting those error when you just submit the macro definition to compile?&lt;/P&gt;
&lt;P&gt;Or do you get them when you try to call it.&amp;nbsp; If so then show the code you used to call it.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 14:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617770#M181087</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-16T14:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617772#M181089</link>
      <description>&lt;P&gt;Maybe that is the issue!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pardon my ignorance but how exactly do I "call" the macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To clarify, you are saying that I provided code that makes up the macro, but I'm never actually submitting code to say "run this macro"?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 14:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617772#M181089</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-01-16T14:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617785#M181096</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/287480"&gt;@anweinbe&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Maybe that is the issue!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pardon my ignorance but how exactly do I "call" the macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To clarify, you are saying that I provided code that makes up the macro, but I'm never actually submitting code to say "run this macro"?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes.&amp;nbsp; To define a macro use %MACRO statement and %MEND statement.&amp;nbsp; To call the macro just use % and the name of the macro.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymacro(dsn);
proc print data=&amp;amp;dsn.; run;
%mend mymacro;

%mymacro(dsn=sashelp.class(obs=3));
%mymacro(dsn=sashelp.cars(obs=3));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jan 2020 15:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617785#M181096</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-16T15:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617797#M181103</link>
      <description>&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologize for not understanding. Perhaps a few answers to these questions might help...&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If I take the macro code from the internet, I see it starts with: &lt;FONT color="#0000FF"&gt;%MACRO EVTSTUDY (INSET=temp.events, OUTSET=temp.eventsOut, OUTSTATS=temp.eventstats, ID=permno, EVTDATE=start, DATA=CRSP, ESTPER=110, START=-1,END=3,GAP=16,GROUP=1,MODEL=ffm); &lt;/FONT&gt;and then ends with this: &lt;FONT color="#0000FF"&gt;%MEND EVTSTUDY;&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT color="#000000"&gt;If I am using SAS studio, can I take the entire macro code and put it into SAS Program and then call it like you noted below? or does it have to be entered as a task / utility? and then create a SAS program that utilizes the code you provided?&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;If I go under "tasks / utilities", would I just create an "advanced task" and past in the entire macro as I found it on the internet"? I tried that and I got this: &lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT color="#000000"&gt;&lt;SPAN class="dialogContentSpan"&gt;&lt;SPAN class="dialogMessageSpan"&gt;Error: Error parsing text XML Parsing Error: not well-formed Location: https:/‌/‌wrds-cloud.wharton.upenn.edu/‌SASStudio/‌main?locale=en_US&amp;amp;zone=GMT-05%3A00&amp;amp;https%3A%2F%2Fwrds-cloud.wharton.upenn.edu%2FSASStudio%2Findex= Line Number 1, Column 1: /‌* WRDS Macro: EVTSTUDY */‌ ^&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN class="dialogContentSpan"&gt;&lt;SPAN class="dialogMessageSpan"&gt;This is my first time trying to utilize and creating a macro. I appreciate your patience with me. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 15:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617797#M181103</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-01-16T15:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617810#M181109</link>
      <description>&lt;P&gt;If you are using SAS/Studio then you should be able to create a program and run it&amp;nbsp; Forget about how to incorporate it into any process flows or task until you get it to run as a normal SAS program first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Start by making a program with just my little example above that defines a trivial macro and calls it twice. Get that to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then make a new program and paste in the macro definition (as copied from the source without any changes) and run it.&amp;nbsp; It should run without errors but produce no output.&amp;nbsp; If you get errors there then there is some issue with the macro definition you received (or perhaps how you copied it into the program editor).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then make another new program and write code to call the macro.&amp;nbsp; Run that and test it. Make sure to turn on the MPRINT option so you can see what SAs code the macro generated in the log.&amp;nbsp; You program should look something like this.&amp;nbsp; Replace the parameter values with values that make sense for the data you have.&amp;nbsp; Remember that for the macro call to work the macro has to have been compiled already. So if you restart your SAS session you will need to resubmit the program that defines the macro first before you can run the program that calls it.&amp;nbsp; But once it is defined in your session you shouldn't have to keep copying it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;
%EVTSTUDY 
(INSET=temp.events
,OUTSET=temp.eventsOut
,OUTSTATS=temp.eventstats
,ID=permno
,EVTDATE=start
,DATA=CRSP
,ESTPER=110
,START=-1
,END=3
,GAP=16
,GROUP=1
,MODEL=ffm
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jan 2020 16:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/617810#M181109</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-16T16:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/618074#M181256</link>
      <description>&lt;P&gt;Tom,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe that I am close! Just some slight modifications needed, but i'm not 100% sure what they are....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the simple code you gave me on the dsn data. That ran over and over without issue! (THANK YOU)&lt;/P&gt;
&lt;P&gt;I created a new program, pasted in the code without modification, and then modified the call statement. That is where I must need a small tweak.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;currently:&lt;/P&gt;
&lt;P&gt;%EVTSTUDY(dsn=sashelp.class(obs=3));&lt;BR /&gt;%EVTSTUDY(dsn=sashelp.cars(obs=3));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do I change the part in parenthesis too? obviously dsn=sashelp.class was the dataset that you used, but what changes do I make? the beginning of my macro looked like this... do I have to put each of these variables in? or do I just do %EVTSTUDY();?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MACRO EVTSTUDY (INSET=, OUTSET=, OUTSTATS=, ID=permno, EVTDATE=, DATA=CRSP,&lt;BR /&gt;ESTPER=, START=,END=,GAP=,GROUP=,MODEL=);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I'm close!!! Thank you kindly for working with me!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 13:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/618074#M181256</guid>
      <dc:creator>anweinbe</dc:creator>
      <dc:date>2020-01-17T13:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Issue - Unbalanced Quotes and White Space</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/618098#M181271</link>
      <description>&lt;P&gt;You cannot call ENVSTUDY with values the parameter DSN that my little example macro used.&amp;nbsp; You need to call it with values for the parameters that it needs.&amp;nbsp; &amp;nbsp;Do not make any changes the source code of the macro (unless you want to change how it works), instead provide your values for the parameters in the macro call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Re-read my previous post and try using the macro call I suggested.&amp;nbsp; But at this point you need to actually understand what the macro is doing at least enough to know what inputs it wants.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 15:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Issue-Unbalanced-Quotes-and-White-Space/m-p/618098#M181271</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-17T15:18:49Z</dc:date>
    </item>
  </channel>
</rss>

