<?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 assign length for n number of character variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159474#M31071</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When working with large number of variables like this you will want to treat these names and other meta data (length type informat format label) like data.&amp;nbsp; Get the names and other meta data into a SAS data set then you can "program" the meta data into the statements you need to define them as variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the meta data data to generate ATTRIB statements into a file that you can %INC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 May 2014 11:56:49 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2014-05-15T11:56:49Z</dc:date>
    <item>
      <title>How to assign length for n number of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159471#M31068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have n number of character variables I want to assign length for all variables.Below is the peace of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data have;&lt;/P&gt;&lt;P&gt;infile datalines missover;&lt;/P&gt;&lt;P&gt;input name$ surname$ id$;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;dishant parikh 101&lt;/P&gt;&lt;P&gt;dishantparikh makwana 10001&lt;/P&gt;&lt;P&gt;piyushpatel shah 10000000&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above data is example of original data. I want assign length for all variables with specifying variable names because there are around 300 character variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your help will appreciate. Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dishant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 06:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159471#M31068</guid>
      <dc:creator>dishant</dc:creator>
      <dc:date>2014-05-15T06:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign length for n number of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159472#M31069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry For Above Line where I mentioned With Instead Of &lt;STRONG&gt;without&lt;/STRONG&gt;.So my concern is I want assign length &lt;STRONG&gt;without &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;specifying variable names&lt;/SPAN&gt;&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 06:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159472#M31069</guid>
      <dc:creator>dishant</dc:creator>
      <dc:date>2014-05-15T06:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign length for n number of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159473#M31070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;length var1-varX $N;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X being the number of variables and N the desired length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the variables need to have different lengths/names, you will need to use macro programming or building the data step in a preceding data step using call execute.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 06:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159473#M31070</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-05-15T06:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign length for n number of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159474#M31071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When working with large number of variables like this you will want to treat these names and other meta data (length type informat format label) like data.&amp;nbsp; Get the names and other meta data into a SAS data set then you can "program" the meta data into the statements you need to define them as variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the meta data data to generate ATTRIB statements into a file that you can %INC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 11:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159474#M31071</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-05-15T11:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign length for n number of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159475#M31072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generate the necessary:&lt;/P&gt;&lt;P&gt;Data have;&lt;BR /&gt;infile datalines missover;&lt;BR /&gt;input name$ surname$ id$;&lt;BR /&gt;datalines;&lt;BR /&gt;dishant parikh 101&lt;BR /&gt;dishantparikh makwana 10001&lt;BR /&gt;piyushpatel shah 10000000&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; set sashelp.vcolumn (where=(libname="WORK" and memname="HAVE")) end=last;&lt;BR /&gt;&amp;nbsp; if _n_=1 then call execute('proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table WANT as&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&amp;nbsp; '||strip(name)||' length=300');&lt;BR /&gt;&amp;nbsp; else call execute(','||strip(name)||' length=300');&lt;BR /&gt;&amp;nbsp; if last then call execute('&amp;nbsp;&amp;nbsp; from HAVE;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;');&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 May 2014 12:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159475#M31072</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-05-15T12:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to assign length for n number of character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159476#M31073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for late replay was unable to replay due to out of station.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to all for giving your valuable time its takes me new level of thinking.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specially thanks to RW9 and data_null_ .Those solution inspired me and help me to solve my problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 14:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-assign-length-for-n-number-of-character-variables/m-p/159476#M31073</guid>
      <dc:creator>dishant</dc:creator>
      <dc:date>2014-05-19T14:45:18Z</dc:date>
    </item>
  </channel>
</rss>

