<?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: how to put the column length into a macro variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497421#M32024</link>
    <description>&lt;P&gt;Very simple!&lt;/P&gt;&lt;P&gt;Thank a lot&lt;/P&gt;</description>
    <pubDate>Thu, 20 Sep 2018 15:07:04 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2018-09-20T15:07:04Z</dc:date>
    <item>
      <title>how to put the column length into a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497378#M32020</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; var1 $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; var2 $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; var3 $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;25&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;var1=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;""&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;var2=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;""&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;var3=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;""&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; columnlength=round(ranuni(0)*25,1);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;/*25 represent the column length of var3. The question is how to get this value to put it into this function. I would like to do the same for each variable*/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;ColumnLength.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;var3=catt(var3,byte(int(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;97&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;26&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;*ranuni(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;))));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497378#M32020</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-09-20T14:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to put the column length into a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497402#M32021</link>
      <description>&lt;P&gt;Use an array in your datastep, then use the vlength function to get the length and the call symputx function to create the macro variable (although why, and why the ranuni is another question).&lt;/P&gt;
&lt;PRE&gt;data test;
  set test;
  array var{3};
  do i=1 to 3;
    call symputx(cats('var',put(i,best.)),vlength(var{i}));
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497402#M32021</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-20T14:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to put the column length into a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497406#M32022</link>
      <description>&lt;P&gt;I would guess the OP is attempting to get a random lower case letter if working on an ASCII system.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 14:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497406#M32022</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-20T14:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to put the column length into a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497420#M32023</link>
      <description>&lt;P&gt;yes&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 15:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497420#M32023</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-09-20T15:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to put the column length into a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497421#M32024</link>
      <description>&lt;P&gt;Very simple!&lt;/P&gt;&lt;P&gt;Thank a lot&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2018 15:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-put-the-column-length-into-a-macro-variable/m-p/497421#M32024</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2018-09-20T15:07:04Z</dc:date>
    </item>
  </channel>
</rss>

