<?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 remove special chracters from columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560060#M156508</link>
    <description>&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input index sales product_id $;
&lt;STRONG&gt;product_id=compress(product_id,'_');&lt;/STRONG&gt;
datalines;
1 10 100_10
1 20 10_100
1 30 1_50
1 15 12_500
2 12 100_10
2 25 10_100
2 25 1_50
2 10 12_500
;

proc transpose data=sample out=SampleT &lt;STRONG&gt;prefix=col&lt;/STRONG&gt;;
var sales;
id product_id;
by index;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 20 May 2019 09:49:59 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2019-05-20T09:49:59Z</dc:date>
    <item>
      <title>how to remove special chracters from columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560056#M156504</link>
      <description>&lt;P&gt;Following type of data I am having for processing...&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input index sales product_id $;
datalines;
1 10 100_10
1 20 10_100
1 30 1_50
1 15 12_500
2 12 100_10
2 25 10_100
2 25 1_50
2 10 12_500
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After passing this data to PROC TRANSPOSE&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=sample out=SampleT;
var sales;
id product_id;
by index;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am getting product_id as '_100_10' in SampleT i don't want first "_" sign to be there in data.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Obs	index  _NAME_  _100_10  _10_100  _1_50  _12_500
 1	  1	  sales	    10	      20     30	     15
 2	  2	  sales	    12	      25     25	     10&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What should I do...?&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 09:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560056#M156504</guid>
      <dc:creator>Kaushik1</dc:creator>
      <dc:date>2019-05-20T09:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special chracters from columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560059#M156507</link>
      <description>&lt;P&gt;This happens because a SAS variable name can not begin with a number..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the question is rather: How do you want to variable names shaped?&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 09:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560059#M156507</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-20T09:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special chracters from columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560060#M156508</link>
      <description>&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input index sales product_id $;
&lt;STRONG&gt;product_id=compress(product_id,'_');&lt;/STRONG&gt;
datalines;
1 10 100_10
1 20 10_100
1 30 1_50
1 15 12_500
2 12 100_10
2 25 10_100
2 25 1_50
2 10 12_500
;

proc transpose data=sample out=SampleT &lt;STRONG&gt;prefix=col&lt;/STRONG&gt;;
var sales;
id product_id;
by index;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 May 2019 09:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560060#M156508</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-05-20T09:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special chracters from columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560063#M156510</link>
      <description>&lt;P&gt;Why this problem is coming, when I am trying to execute in SAS University Edition and SAS 9.4(desktop edition) but not in SAS Studio 3.8?&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 10:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560063#M156510</guid>
      <dc:creator>Kaushik1</dc:creator>
      <dc:date>2019-05-20T10:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special chracters from columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560067#M156514</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255853"&gt;@Kaushik1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Why this problem is coming, when I am trying to execute in SAS University Edition and SAS 9.4(desktop edition) but not in SAS Studio 3.8?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is most probably because the Workspace Server behind SAS Studio is configured to run with&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=v7;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead of validvarname=any. Which is a very good idea IMO, as it prevents you from having silly column names that need the "name literal" construct every time you use them.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 10:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560067#M156514</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-20T10:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special chracters from columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560186#M156575</link>
      <description>&lt;P&gt;I am studying PROC TRANSPOSE right now for the certification exam, so this is of interest to me!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The COMPRESS function doesn't work for me as it is shown in the solution, because it removes the underscore from the input data set before the transpose. You would have to use it on all the variables in the output data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the correct solution was this from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; which allows variables to start with a number:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or you could add the PREFIX= option to PROC TRANSPOSE like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=sample out=SampleT prefix=n;
var sales;
id product_id;
by index;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 14:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560186#M156575</guid>
      <dc:creator>maggiem_sas</dc:creator>
      <dc:date>2019-05-21T14:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special chracters from columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560362#M156674</link>
      <description>&lt;P&gt;Option validvarname=any;&lt;/P&gt;&lt;P&gt;works.&lt;/P&gt;&lt;P&gt;problem with second solution is, for different input data it will prefix 'n' which is not preferable.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 06:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-chracters-from-columns/m-p/560362#M156674</guid>
      <dc:creator>Kaushik1</dc:creator>
      <dc:date>2019-05-21T06:17:19Z</dc:date>
    </item>
  </channel>
</rss>

