<?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: New Titles within a Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226770#M267882</link>
    <description>&lt;P&gt;Awesome thanks for the help this worked. Totally forgot about adding delimiters should've known from the error messages I was getting.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Sep 2015 16:25:23 GMT</pubDate>
    <dc:creator>jacob_klimek</dc:creator>
    <dc:date>2015-09-22T16:25:23Z</dc:date>
    <item>
      <title>New Titles within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226751#M267877</link>
      <description>&lt;P&gt;I am trying to add unique titles to my outputs for proc means and proc univariate results, but the only way I know how to do this is through the insertion of a macro variable which can only be one word. I could use "_" but it needs to be cleaner. Anyone know of a way to create unique titles within a macro process?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have so far looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;set hadbefore;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let varA=&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;def&lt;/P&gt;&lt;P&gt;ghi&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;%let varB=&lt;/P&gt;&lt;P&gt;j&amp;nbsp;&amp;nbsp;&amp;nbsp; k&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l&lt;/P&gt;&lt;P&gt;m&amp;nbsp;&amp;nbsp;n&amp;nbsp;&amp;nbsp;&amp;nbsp; o&lt;/P&gt;&lt;P&gt;p&amp;nbsp;&amp;nbsp; q&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;%do i=1 %to 3;&lt;/P&gt;&lt;P&gt;ods noproctitle;&lt;/P&gt;&lt;P&gt;%let v = %scan(&amp;amp;varA, &amp;amp;i.);&lt;/P&gt;&lt;P&gt;%let t = %scan(&amp;amp;varB, &amp;amp;i.);&lt;/P&gt;&lt;P&gt;title "&amp;amp;v.";&lt;/P&gt;&lt;P&gt;title2 "&amp;amp;t.";&lt;/P&gt;&lt;P&gt;proc means data=test;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (another similar program with proc univariate as well)&lt;/P&gt;&lt;P&gt;var &amp;amp;v;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;%test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What it does for the&amp;nbsp; title 2 is prints one word for each instead of the whole line. I have tried adding in quotations but then it runs with an error because it picks up the first word with one quotation mark.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be great thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 15:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226751#M267877</guid>
      <dc:creator>jacob_klimek</dc:creator>
      <dc:date>2015-09-22T15:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: New Titles within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226757#M267878</link>
      <description>&lt;BLOCKQUOTE&gt;but the only way I know how to do this is through the insertion of a macro variable which can only be one word&lt;/BLOCKQUOTE&gt;Macro variables can be as many words as you want them to be. So I don't understand this limitation you are stating.&lt;BLOCKQUOTE&gt;What it does for the title 2 is prints one word for each instead of the whole line.&lt;/BLOCKQUOTE&gt;This also makes no sense to me. Can you give us an example of what title you would actually like to see?</description>
      <pubDate>Tue, 22 Sep 2015 15:33:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226757#M267878</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-09-22T15:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: New Titles within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226761#M267879</link>
      <description>&lt;P&gt;Okay, what I meant was what is stored only seems to be taking on one word values. For example, I want two titles in my output. The first title as the variable's name, and the second title as a description of that variable. So for the macro variable varA I store the variable name, and for the macro variable varB I want to store the variable description but I don't know the syntax for creating a macro variable that calls multiple words.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 15:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226761#M267879</guid>
      <dc:creator>jacob_klimek</dc:creator>
      <dc:date>2015-09-22T15:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: New Titles within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226765#M267880</link>
      <description>&lt;P&gt;I do not understand why you have all that macro code? &amp;nbsp;Post some have and some want so its easier to see. &amp;nbsp;Anyways, SAS have specific caommands for dealing with this type of thing, its called by var processing. &amp;nbsp;First get your data into a normalised structure, its far easier to work with, and you can use by group processing - note its also CDISC standard.&lt;/P&gt;&lt;P&gt;dataset have looks like:&lt;/P&gt;&lt;P&gt;parameter &amp;nbsp;result &amp;nbsp; &amp;nbsp; idvar&lt;/P&gt;&lt;P&gt;A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01&lt;/P&gt;&lt;P&gt;A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02&lt;/P&gt;&lt;P&gt;B &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;now I can just do:&lt;/P&gt;&lt;P&gt;proc means data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var result;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by parameter;&lt;/P&gt;&lt;P&gt;&amp;nbsp; out=want n=n...;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=want nowd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;columns ...;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;title1 "This is the title for parameter = #byvar(parameter)";&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;by parameter;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So much simpler, no macro code. &amp;nbsp;Examples:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi23/Coders/p75.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi23/Coders/p75.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 16:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226765#M267880</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-09-22T16:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: New Titles within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226767#M267881</link>
      <description>You use the scan function with no delimiter specified, which means the default delimiter is a SPACE. Add a delimiter to the macro variable and the corresponding delimiter to the SCAN function to separate the macro variables.&lt;BR /&gt;&lt;BR /&gt;%let varB=&lt;BR /&gt;j k l|&lt;BR /&gt;m n o|&lt;BR /&gt;p q r&lt;BR /&gt;;&lt;BR /&gt;%let i=1;&lt;BR /&gt;%let t = %scan(&amp;amp;varB, &amp;amp;i., |);&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;t;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Sep 2015 16:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226767#M267881</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-22T16:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: New Titles within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226770#M267882</link>
      <description>&lt;P&gt;Awesome thanks for the help this worked. Totally forgot about adding delimiters should've known from the error messages I was getting.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 16:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226770#M267882</guid>
      <dc:creator>jacob_klimek</dc:creator>
      <dc:date>2015-09-22T16:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: New Titles within a Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226773#M267883</link>
      <description>&lt;P&gt;Use underscore &amp;amp;i, so it will change the name for every iteration.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 16:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-Titles-within-a-Macro/m-p/226773#M267883</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-09-22T16:37:20Z</dc:date>
    </item>
  </channel>
</rss>

