<?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: Extract Information from variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372183#M88946</link>
    <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; haves;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;infile&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"...\textfile.txt"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"name="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; name $ @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"id="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; id @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"size="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; size @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"type="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; type $ ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2017 14:20:18 GMT</pubDate>
    <dc:creator>DoumbiaS</dc:creator>
    <dc:date>2017-06-30T14:20:18Z</dc:date>
    <item>
      <title>Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372153#M88936</link>
      <description>&lt;P&gt;Hi Guys i have a single variable with all the data in that i need to create multiple variables out of it i have been trying it with substring function but no luck can you please help me out with this thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i have:&lt;/P&gt;&lt;P&gt;sample&amp;nbsp;&lt;/P&gt;&lt;P&gt;name=sammy id=123456 size=213456 type=txt&lt;/P&gt;&lt;P&gt;name=dummy id=34256 size= 2314 type=xlsx&lt;/P&gt;&lt;P&gt;name=sample id=12456 size=1111111111 type=doc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i want in new dataset is&lt;/P&gt;&lt;P&gt;name &amp;nbsp; &amp;nbsp; id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; size &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;type&lt;/P&gt;&lt;P&gt;sammy &amp;nbsp;&lt;SPAN&gt;123456 &amp;nbsp;213456 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; txt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dummy &amp;nbsp;&lt;SPAN&gt;34256 &amp;nbsp; &amp;nbsp;2314 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sample &amp;nbsp;&lt;SPAN&gt;12456 &amp;nbsp; &amp;nbsp;&amp;nbsp;1111111111 &amp;nbsp; &amp;nbsp; doc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks again&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 13:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372153#M88936</guid>
      <dc:creator>imvenky</dc:creator>
      <dc:date>2017-06-30T13:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372160#M88939</link>
      <description>&lt;P&gt;What you have there is a named input file. &amp;nbsp;You can read it in directly, no need to post process it. &amp;nbsp;Take a look at:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/24/692.html" target="_blank"&gt;http://support.sas.com/kb/24/692.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To do it manually is a pain, you would setup a datastep, then loop over the pairs of values (i.e. scan using " " as delimiter) and then scan within that by "=" for first/second pair. &amp;nbsp;Too much work, do it in the read step.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 13:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372160#M88939</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-30T13:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372164#M88941</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the input file that i have is a csv and it doesn't have a variable name over there&lt;/P&gt;&lt;P&gt;I imported it to sas dataset and it just cameup like that&lt;/P&gt;&lt;P&gt;what i have in csv is&lt;/P&gt;&lt;P&gt;name=sammy id=123456 size=213456 type=txt&lt;/P&gt;&lt;P&gt;name=dummy id=34256 size= 2314 type=xlsx&lt;/P&gt;&lt;P&gt;name=sample id=12456 size=1111111111 type=doc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i want in new dataset is&lt;/P&gt;&lt;P&gt;name &amp;nbsp; &amp;nbsp; id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; size &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;type&lt;/P&gt;&lt;P&gt;sammy &amp;nbsp;&lt;SPAN&gt;123456 &amp;nbsp;213456 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; txt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dummy &amp;nbsp;&lt;SPAN&gt;34256 &amp;nbsp; &amp;nbsp;2314 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sample &amp;nbsp;&lt;SPAN&gt;12456 &amp;nbsp; &amp;nbsp;&amp;nbsp;1111111111 &amp;nbsp; &amp;nbsp; doc&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;venky&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 13:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372164#M88941</guid>
      <dc:creator>imvenky</dc:creator>
      <dc:date>2017-06-30T13:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372180#M88945</link>
      <description>&lt;P&gt;It isn't a CSV file you have. &amp;nbsp;A CSV file means Comma Separated Variable file. &amp;nbsp;I.e. one row with headers (optional), then one row per data row, with each element separated by a comma. &amp;nbsp;What you have is a named parameter file which someone has chosen to hange the file extension to CSV. &amp;nbsp;File extension can be anything you want, and indicate to the OS what program to use to open them. &amp;nbsp;Excel can open files and process the inform in it as you have CSV associated with Excel, however when Excel reads it, it will not process it properly and show the text all in col1. &amp;nbsp;To import the file correctly into SAS, ignore Excel, and use the datastep import program example given in the link I provided, this will correctly read the file. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then perhaps explain to the person sending the file why giving a file extension the wrong identifier can lead to all kinds of confusion.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 14:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372180#M88945</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-30T14:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372183#M88946</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; haves;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;infile&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;"...\textfile.txt"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"name="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; name $ @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"id="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; id @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"size="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; size @&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"type="&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; type $ ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 14:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372183#M88946</guid>
      <dc:creator>DoumbiaS</dc:creator>
      <dc:date>2017-06-30T14:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372197#M88949</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/151797"&gt;@imvenky&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the input file that i have is a csv and it doesn't have a variable name over there&lt;/P&gt;
&lt;P&gt;I imported it to sas dataset and it just cameup like that&lt;/P&gt;
&lt;P&gt;what i have in csv is&lt;/P&gt;
&lt;P&gt;name=sammy id=123456 size=213456 type=txt&lt;/P&gt;
&lt;P&gt;name=dummy id=34256 size= 2314 type=xlsx&lt;/P&gt;
&lt;P&gt;name=sample id=12456 size=1111111111 type=doc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please show the code you are using to read that file and maybe post a few lines of the data if possible. If you post some data please use a code boxe opened with the forum {i} menu icon as the main message windows reformat text and may introduce other issues.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 14:45:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372197#M88949</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-30T14:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372217#M88955</link>
      <description>&lt;P&gt;If you have something like this in SAS dataset. You can do use below code. But &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;suggestion is the way to go&lt;/P&gt;
&lt;PRE&gt;data newone;
set sample;
name=prxchange('s/name=|id.+//', -1, trim(col1));
id=prxchange('s/^\S+|id=|\s+size.+//',-1 ,trim(col1));
size=prxchange('s/^\S+\s+\S+\s+|size=\s?|\s+.+$//',-1 ,trim(col1));
type=prxchange('s/.+=//',-1 ,trim(col1));
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jun 2017 15:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372217#M88955</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-30T15:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372228#M88959</link>
      <description>&lt;P&gt;A wonderfull function this "prxchange".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2017 16:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372228#M88959</guid>
      <dc:creator>DoumbiaS</dc:creator>
      <dc:date>2017-06-30T16:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Information from variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372386#M89042</link>
      <description>&lt;P&gt;It is called NAMED INPUT method .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input name= $40. id=  size= type= $40.;
cards;
name=sammy id=123456 size=213456 type=txt
name=dummy id=34256 size= 2314 type=xlsx
name=sample id=12456 size=1111111111 type=doc
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Jul 2017 06:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Extract-Information-from-variable/m-p/372386#M89042</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-07-01T06:46:03Z</dc:date>
    </item>
  </channel>
</rss>

