<?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: Syntax error from Macro variable usage in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481330#M286728</link>
    <description>&lt;P&gt;The examples I have provided here are just a few survey questions. The Macro variables are to enable flexibility as I am trying to build a macro that tests the survey questions (currently 20 surveys being built) against the survey questions in the Master doc to see if the analyst output file is/isnt consistent with the Master doc. Some survey questions have [staff_name], some have [Company_Names] and some have others variables that have, in the master doc, been hardcoded in square brackets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing these manual changes will defeat the purpose of creating the macro&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jul 2018 02:48:22 GMT</pubDate>
    <dc:creator>frupaul</dc:creator>
    <dc:date>2018-07-26T02:48:22Z</dc:date>
    <item>
      <title>Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481237#M286721</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A challenging one and apologies if its a bit of a read. Just want to give you as much information as possible to enable you figure out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following data sets (codes follow below);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-07-25 at 19.57.03.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22005iE4672892FA96E780/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2018-07-25 at 19.57.03.png" alt="Screen Shot 2018-07-25 at 19.57.03.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Created with the below codes respectively:&lt;/P&gt;&lt;P&gt;data Master_File;&lt;BR /&gt;infile datalines dlm=',';&lt;BR /&gt;length Survey_ref $8 Question1 $90;&lt;BR /&gt;input Survey_ref $ Question1 $;&lt;BR /&gt;cards;&lt;BR /&gt;PPTV,How Likely are you to recommend [Staff_Name] from [Company_Name]?&lt;BR /&gt;JJNT,How Likely are you to recomment [Company_Name] to a Friend?&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;data Customer_Survey;&lt;BR /&gt;infile datalines dlm=',';&lt;BR /&gt;length Survey_ref $8 TQuestion1 $90 TStaff_Name $20 TCompany_Name $15;&lt;BR /&gt;input Survey_ref $ TQuestion1 $ TStaff_Name $ TCompany_Name $;&lt;BR /&gt;cards;&lt;BR /&gt;PPTV, How Likely are you to recommend Alex Jefferson from Morrisons?,Alex Jefferson,Morrisons&lt;BR /&gt;JJNT, How Likely are you to recommend Morrisons to a Friend?,Pablo, Morrisons&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OBJECTIVE:&lt;/P&gt;&lt;P&gt;I wish to compare survey questions on the different Files (Question1 Vs TQuestion1) for each survey_ref. To make this possible, go through the below steps;&lt;/P&gt;&lt;P&gt;A. Try to Standardize both files e.g. by replacing the Staff_Name (value: Alex Jefferson) in TQuestion1 with [Staff_Name]&amp;nbsp; and also replace company name (Value: Morrisons) with [Company_Name] (These value substitutions&amp;nbsp;are done in step C but writing it here gives a bit more context). Also, these value substitutions work&amp;nbsp; if I use actually values assigned to the Macro variables but doesn't work when i use the macro variables themselves.&lt;/P&gt;&lt;P&gt;B. Merge both Files&lt;/P&gt;&lt;P&gt;C. Compare values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;P&gt;data Master_File_simplified;&lt;BR /&gt;set Master_File;&lt;/P&gt;&lt;P&gt;/* Extract words in square brackets in Question 1*/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Inserted_word1 = scan(Question1,2,'[]');&lt;BR /&gt;Inserted_Word2 = scan(Question1,4,'[]');&lt;/P&gt;&lt;P&gt;/*Store Extracted words in Macro variables*/&lt;BR /&gt;call symput('Inserted_word1',Inserted_word1);&lt;BR /&gt;call symput('Inserted_Word2',Inserted_Word2);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B.&lt;/P&gt;&lt;P&gt;/*Merge Files - For simplicity, filtering for survey_ref='PPTV' only*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Mapped_file;&lt;BR /&gt;merge Master_File_Simplified(in=M where=(survey_ref='PPTV'))&lt;BR /&gt;Customer_Survey(in=T where=(survey_ref='PPTV'));&lt;BR /&gt;by survey_ref;&lt;BR /&gt;if M and T;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;table from this is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-07-25 at 20.08.41.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22006i9FBBBF97452699FF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2018-07-25 at 20.08.41.png" alt="Screen Shot 2018-07-25 at 20.08.41.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;C.&lt;/P&gt;&lt;P&gt;&amp;nbsp;data Final;&lt;BR /&gt;set Mapped_file;&lt;BR /&gt;if not missing(&amp;amp;Inserted_word1) then do;&lt;BR /&gt;TTQuestion1=transtrn(TQuestion1,&amp;amp;Inserted_word1.,"[&amp;amp;Inserted_word1.]");&lt;BR /&gt;if not missing(&amp;amp;Inserted_Word2) then TTQuestion1=transtrn(TTQuestion1,&amp;amp;Inserted_word2.,"[&amp;amp;Inserted_word2.]");&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error generated is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-07-25 at 21.05.37.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22011i8472DF2BE7E81FDC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2018-07-25 at 21.05.37.png" alt="Screen Shot 2018-07-25 at 21.05.37.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i successfully make these comparisons without getting this error please. Mind you this is a simplification of the actual problem. The real problem has many different survey questions in that master File, with different sorts of hardcoded values in square brackets.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 20:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481237#M286721</guid>
      <dc:creator>frupaul</dc:creator>
      <dc:date>2018-07-25T20:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481240#M286722</link>
      <description>&lt;P&gt;Post the exact log. It usually does a really good job of indicating where the errors are.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're using nested functions it also helps to unnest it for testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And add a period after the macro variable name so SAS knows when the macro variable ends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;TTQuestion1=transtrn(TQuestion1,&amp;amp;Inserted_word1,"[&amp;amp;Inserted_word1&lt;STRONG&gt;.&lt;/STRONG&gt;]"); &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jul 2018 19:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481240#M286722</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-25T19:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481241#M286723</link>
      <description>&lt;P&gt;Try adding this statement at the beginning, then rerun:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options mprint symbolgen;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The results will likely make debugging easy (although there might be a longer log to sift through).&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 19:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481241#M286723</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-25T19:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481246#M286724</link>
      <description>&lt;P&gt;I have added the full stop at the end of the macro variables and added updated the post with the full log&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 19:54:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481246#M286724</guid>
      <dc:creator>frupaul</dc:creator>
      <dc:date>2018-07-25T19:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481307#M286725</link>
      <description>&lt;P&gt;Please do not post pictures of code or log. It makes it very hard to reference things. If you had pasted the code from the log into a code box as opened using the {I} icon then we could copy a few relative lines to highlight issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You claimed that the code was&lt;/P&gt;
&lt;PRE&gt;if not missing(&amp;amp;Inserted_Word2) then TTQuestion1=transtrn(TTQuestion1,&amp;amp;Inserted_word2.,"[&amp;amp;Inserted_word2.]");&lt;/PRE&gt;
&lt;P&gt;But if you look at the line with the error you will see that there are no ( ) around &amp;amp;inserted_word2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data junk;
   x = 3;
   if missing x then put "missing x";
   else put "not missing x";
run;&lt;/PRE&gt;
&lt;P&gt;generates the same error for x. Compare to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data junk;
   x = 3;
   if missing ( x ) then put "missing x";
   else put "not missing x";
run;&lt;/PRE&gt;
&lt;P&gt;Also in the construct "if not missing(&amp;amp;Inserted_Word2) then " &amp;amp;inserted_word would be expected to be an existing variable in the dataset MAPPED_FILE. But I don't think there is one as you don't show where it would be created. There is TCompany_name but no company_name variable. So Company_name would be created in the use of missing(company_name), be numeric and have a missing value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 23:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481307#M286725</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-25T23:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481315#M286726</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the purpose of macro variables in your program?&lt;/P&gt;
&lt;P&gt;It looks like you already have the data in real dataset variables.&amp;nbsp; Just use those variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  merge Master_File Customer_Survey ;
  by Survey_ref ;
  length want $200 ;
  want=Question1;
  if not missing(TStaff_Name) then want=transtrn(want,"[Staff_Name]",trimn(TStaff_Name));
  if not missing(TCompany_Name) then want=transtrn(want,"[Company_Name]",trimn(TCompany_Name));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;57    data _null_;
58      set;
59      put (_all_) (=/) / ;
60    run;


Survey_ref=JJNT
Question1=How Likely are you to recomment [Company_Name] to a Friend?
TQuestion1=How Likely are you to recommend Morrisons to a Friend?
TStaff_Name=Pablo
TCompany_Name=Morrisons
want=How Likely are you to recomment Morrisons to a Friend?


Survey_ref=PPTV
Question1=How Likely are you to recommend [Staff_Name] from [Company_Name]?
TQuestion1=How Likely are you to recommend Alex Jefferson from Morrisons?
TStaff_Name=Alex Jefferson
TCompany_Name=Morrisons
want=How Likely are you to recommend Alex Jefferson from Morrisons?
NOTE: There were 2 observations read from the data set WORK.WANT.
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 02:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481315#M286726</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-26T02:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481328#M286727</link>
      <description>&lt;P&gt;Apologies in the course of recreating the problem i missed&amp;nbsp;a where option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Master_File_simplified;&lt;BR /&gt;set Master_File(where=(survey_ref='PPTV'));&lt;BR /&gt;Inserted_word1 = scan(Question1,2,'[]');&lt;BR /&gt;Inserted_Word2 = scan(Question1,4,'[]');&lt;BR /&gt;call symput('Inserted_word1',Inserted_word1);&lt;BR /&gt;call symput('Inserted_Word2',Inserted_Word2);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With this, the code runs without errors but doesn't generate the expected table after running the last step.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 02:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481328#M286727</guid>
      <dc:creator>frupaul</dc:creator>
      <dc:date>2018-07-26T02:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481330#M286728</link>
      <description>&lt;P&gt;The examples I have provided here are just a few survey questions. The Macro variables are to enable flexibility as I am trying to build a macro that tests the survey questions (currently 20 surveys being built) against the survey questions in the Master doc to see if the analyst output file is/isnt consistent with the Master doc. Some survey questions have [staff_name], some have [Company_Names] and some have others variables that have, in the master doc, been hardcoded in square brackets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doing these manual changes will defeat the purpose of creating the macro&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 02:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481330#M286728</guid>
      <dc:creator>frupaul</dc:creator>
      <dc:date>2018-07-26T02:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481339#M286729</link>
      <description>&lt;P&gt;I am still not sure how macro variables help this problem in any way.&lt;/P&gt;
&lt;P&gt;Just restructure the data so that you have a list of QUESTIONS and their associate FIELDS.&amp;nbsp; Should be easy enough to get the field names from the questions using regular expressions if you have to.&amp;nbsp; So you would have something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Master_File;
  infile datalines dlm='|' dsd truncover ;
  length Survey_ref Question $90 Field $32;
  input Survey_ref Question Field;
cards;
JJNT|How Likely are you to recomment [Company_Name] to a Friend?|Company_Name
PPTV|How Likely are you to recommend [Staff_Name] from [Company_Name]?|Company_Name
PPTV|How Likely are you to recommend [Staff_Name] from [Company_Name]?|Staff_Name
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you want another data file that has all of the values of the Fields for each target that you want generate questions text for.&amp;nbsp; You might even have values for fields you don't need for this survey, like Phone_Number in this example.&amp;nbsp; Perhaps you just need to use PROC TRANSPOSE on your existing data?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Customer_Survey;
  infile datalines dlm='|' dsd truncover ;
  length Survey_ref $8 Field $32 Value $50 ;
  input Survey_ref Field Value;
cards;
JJNT|Staff_Name|Pablo
JJNT|Company_Name|Morrisons
JJNT|Phone_Number|XXX-555-1234
PPTV|Staff_Name|Alex Jefferson
PPTV|Company_Name|Morrisons
PPTV|Phone_Number|XXX-555-1234
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then combine the two.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
create table survey_question_fields as
  select a.*,b.value
  from Master_File a
  left join Customer_Survey b
    on a.Survey_ref = b.Survey_ref
   and a.Field = b.Field
  order by a.Survey_ref,a.question,a.field 
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then collapse back to a single row per question while making the text replacements.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT ;
  do until (last.question);
    set survey_question_fields ;
    by survey_ref question ;
    if first.question then new_question=question ;
    if not missing(value) then new_question=transtrn(new_question,cats('[',field,']'),trimn(value));
  end;
  keep survey_ref new_question ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 514px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22024iF86713136BD08785/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 04:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481339#M286729</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-26T04:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481366#M286730</link>
      <description>&lt;P&gt;Thanks for the response. I think this works if one does all the transposing. However, I have not been able to figure out how to transpose character fields in SAS. Any clue how to transpose the customer table i provided to arrive at yours?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 07:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481366#M286730</guid>
      <dc:creator>frupaul</dc:creator>
      <dc:date>2018-07-26T07:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Syntax error from Macro variable usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481437#M286731</link>
      <description>&lt;P&gt;It is no harder to transpose character variable, although you are REQUIRED to use the VAR statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Customer_Survey;
infile datalines dlm=',';
length Survey_ref $8 TQuestion1 $90 TStaff_Name $20 TCompany_Name $15;
input Survey_ref $ TQuestion1 $ TStaff_Name $ TCompany_Name $;
cards;
PPTV, How Likely are you to recommend Alex Jefferson from Morrisons?,Alex Jefferson,Morrisons
JJNT, How Likely are you to recommend Morrisons to a Friend?,Pablo, Morrisons
;

proc transpose data=Customer_Survey out=want ;
  by Survey_ref TQuestion1 notsorted ;
  var TStaff_Name TCompany_Name ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22035iD5A0C0BF60C33619/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 11:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Syntax-error-from-Macro-variable-usage/m-p/481437#M286731</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-26T11:32:09Z</dc:date>
    </item>
  </channel>
</rss>

