<?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 delete variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76741#M22255</link>
    <description>Try this:&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
infile "data.txt" dlm=" ";&lt;BR /&gt;
input name $ @@;&lt;BR /&gt;
if compress(name,"0123456789") = name;&lt;BR /&gt;
input age gender $ height $ smoker $ / score1 1 score2 2 score3 3 score4 4 score5 5;&lt;BR /&gt;
run;</description>
    <pubDate>Mon, 26 Oct 2009 19:28:03 GMT</pubDate>
    <dc:creator>cjohnson</dc:creator>
    <dc:date>2009-10-26T19:28:03Z</dc:date>
    <item>
      <title>how to delete variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76740#M22254</link>
      <description>Hello all&lt;BR /&gt;
Here is my raw data:&lt;BR /&gt;
&lt;BR /&gt;
Mike 35 male tall smoker&lt;BR /&gt;
12312354152612&lt;BR /&gt;
1231243612436152436&lt;BR /&gt;
12123451432451&lt;BR /&gt;
1234512315423&lt;BR /&gt;
142351323123&lt;BR /&gt;
Sara 26 female short smoker&lt;BR /&gt;
12222221423541&lt;BR /&gt;
14253513254&lt;BR /&gt;
1231243142&lt;BR /&gt;
12434541235142543&lt;BR /&gt;
Monica 24 female short nonsmoker&lt;BR /&gt;
124152345142&lt;BR /&gt;
1423451324&lt;BR /&gt;
1243541325&lt;BR /&gt;
124354132&lt;BR /&gt;
1&lt;BR /&gt;
12134124124351&lt;BR /&gt;
123451324312541323&lt;BR /&gt;
13245312435412&lt;BR /&gt;
&lt;BR /&gt;
The first line has basic information about the observation, then there are numerous variables( they are test scores values from 1-6 )&lt;BR /&gt;
I found out that only the first five scores are needed and to delete everything else&lt;BR /&gt;
How do I just retain the first line and only the first 5 scores and then move to the second observation (Sara)&lt;BR /&gt;
&lt;BR /&gt;
this is how I want my output:&lt;BR /&gt;
Mike 35 male tall smoker 12312&lt;BR /&gt;
Sara 26 female short smoker 12222&lt;BR /&gt;
Monica 24 female short nonsmoker 12415&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Any help would be greatly appreciated. &lt;BR /&gt;
SAS newbie</description>
      <pubDate>Mon, 26 Oct 2009 17:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76740#M22254</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-26T17:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76741#M22255</link>
      <description>Try this:&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
infile "data.txt" dlm=" ";&lt;BR /&gt;
input name $ @@;&lt;BR /&gt;
if compress(name,"0123456789") = name;&lt;BR /&gt;
input age gender $ height $ smoker $ / score1 1 score2 2 score3 3 score4 4 score5 5;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 26 Oct 2009 19:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76741#M22255</guid>
      <dc:creator>cjohnson</dc:creator>
      <dc:date>2009-10-26T19:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76742#M22256</link>
      <description>Wow, thanks so much! &lt;BR /&gt;
How does it work?&lt;BR /&gt;
I am looking into compress function but still dont know how does it work?&lt;BR /&gt;
also &lt;BR /&gt;
lets say I want to read the first 5 observation of each line, do i just create a do loop?&lt;BR /&gt;
thanks again

Message was edited by: bluelion</description>
      <pubDate>Tue, 27 Oct 2009 02:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76742#M22256</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-27T02:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76743#M22257</link>
      <description>Hi.&lt;BR /&gt;
&lt;BR /&gt;
Check the online doc for the COMPRESS function:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/tsref/59770/HTML/default/a003081143.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/tsref/59770/HTML/default/a003081143.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Tue, 27 Oct 2009 08:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76743#M22257</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-10-27T08:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to delete variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76744#M22258</link>
      <description>Here is how it works.  The datastep reads in the file data.txt, which we are saying is space delimited.  It then reads the first variable into name.  The @@ says don't go to the next line yet.  SAS doesn't have an isnumeric function, so we test it by removing the numbers with compress and seeing if we changed it.  If not, then we read in the rest of the variables (the / says go to the next line for the rest of the variables).  &lt;BR /&gt;
&lt;BR /&gt;
Not sure what you mean by the first 5 observations of each line.  The data step has a built in loop, so you won't need a do loop.  Do you mean you want to read in only 5 records total?</description>
      <pubDate>Tue, 27 Oct 2009 12:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-delete-variables/m-p/76744#M22258</guid>
      <dc:creator>cjohnson</dc:creator>
      <dc:date>2009-10-27T12:07:13Z</dc:date>
    </item>
  </channel>
</rss>

