<?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 create variable like this? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101789#M28574</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or it should be:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;b = put(catt(substr('xxxxxxxxxx',1,10-length(a)),a),$10.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jul 2012 16:07:35 GMT</pubDate>
    <dc:creator>Linlin</dc:creator>
    <dc:date>2012-07-09T16:07:35Z</dc:date>
    <item>
      <title>how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101782#M28567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is a column A whoes format&amp;nbsp; is&amp;nbsp; $7, I want create a new column B with $10.&amp;nbsp; the rule of create B is fill 'x' on the left side of A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;1.&lt;/P&gt;&lt;P&gt;in column A,a row has value&amp;nbsp;&amp;nbsp; '12345'&lt;/P&gt;&lt;P&gt;I want to create B with value 'XXXXX12345' ($10.)&lt;/P&gt;&lt;P&gt;2.&lt;/P&gt;&lt;P&gt;in column A,a row has value&amp;nbsp;&amp;nbsp; '1234567'&lt;/P&gt;&lt;P&gt;I want to create B with value 'XXX1234567'($10.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2012 20:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101782#M28567</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-07-06T20:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101783#M28568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input a $7.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1234567&lt;/P&gt;&lt;P&gt;1234&lt;/P&gt;&lt;P&gt;12345&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;b=cats(repeat('x',9-length(a)),a);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2012 20:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101783#M28568</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-07-06T20:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101784#M28569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use TRANSLATE (or even TRANWRD) function.&lt;/P&gt;&lt;P&gt;Use the RIGHT function to get the original value moved to the right then replace the spaces with XXX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; length b $ 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; b=a;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; b=translate(right(b),'X',' ');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; put (a b) (= $quote.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;a="1234567" b="XXX1234567"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;a="1234" b="XXXXXX1234"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;a="12345" b="XXXXX12345"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that it is the LENGTH of the character variable that is important, not the FORMAT that is attached to it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2012 22:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101784#M28569</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-07-06T22:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101785#M28570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;borrowed Astounding's code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;a='1234567';&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;a='123';&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;length b $10;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;b='xxxxxxxxxx';&lt;/P&gt;&lt;P&gt;substr(b, 10-length(a)+1) = a;&lt;/P&gt;&lt;P&gt;proc print;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2012 23:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101785#M28570</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-07-06T23:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101786#M28571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... the more the merrier ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;proc format;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;picture a low-high='0000000000' (fill='X');&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;b = put(input(a,7.),a.);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Jul 2012 14:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101786#M28571</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-07-07T14:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101787#M28572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Mike&lt;/P&gt;&lt;P&gt;If we have dataset like this:(not numbers but characters),how to do it in this way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input a $7.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;aaaaaa&lt;/P&gt;&lt;P&gt;bbbbb&lt;/P&gt;&lt;P&gt;cccc&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2012 12:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101787#M28572</guid>
      <dc:creator>Mike_Davis</dc:creator>
      <dc:date>2012-07-09T12:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101788#M28573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... PICTURE formats work with numeric variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there have been several nice solutions posted that work with character data, here's another possibility ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;length b $10;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;b =catt(a,substr('xxxxxxxxxx',1,9-length(a)));&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;similar to &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Haikuo&lt;/SPAN&gt; 's solution, but you should use a length statement when using the CAT functions given that the default length of the result is 200&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;if you really wanted a one statement solution that gives you a variable with a length of 10, you could get rid of the LENGTH statement and use a PUT function with the CATT result ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data want;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;set have;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;b = put(catt(a,substr('xxxxxxxxxx',1,9-length(a))),$10.);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2012 15:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101788#M28573</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-07-09T15:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to create variable like this?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101789#M28574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or it should be:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;b = put(catt(substr('xxxxxxxxxx',1,10-length(a)),a),$10.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2012 16:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-create-variable-like-this/m-p/101789#M28574</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-07-09T16:07:35Z</dc:date>
    </item>
  </channel>
</rss>

