<?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: create new dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72738#M15666</link>
    <description>First, look at the documentation for the infile statement.&lt;BR /&gt;
You do not have all fields in all lines so you will need an infile option like MISSOVER or TRUNCOVER.&lt;BR /&gt;
&lt;BR /&gt;
Second, I would recommend you use a three step approach.&lt;BR /&gt;
&lt;BR /&gt;
1)  Data step to read in the data.&lt;BR /&gt;
      if ss = . then delete;&lt;BR /&gt;
&lt;BR /&gt;
2)  PROC SORT data=_______; by u_code, s_value, ss;&lt;BR /&gt;
&lt;BR /&gt;
3) Data step to produce the desired set.&lt;BR /&gt;
&lt;BR /&gt;
Data last_step;&lt;BR /&gt;
  set in_data;&lt;BR /&gt;
  by u_code, s_value, ss;&lt;BR /&gt;
  if first.s_value then output;&lt;BR /&gt;
run;</description>
    <pubDate>Wed, 31 Mar 2010 17:15:13 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-03-31T17:15:13Z</dc:date>
    <item>
      <title>create new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72734#M15662</link>
      <description>How can I create this kind dataset from data a?&lt;BR /&gt;
the reqirement is  the &lt;U&gt;unique code&lt;/U&gt; with &lt;U&gt;smaller score vale&lt;/U&gt; and alos &lt;U&gt;non-missing ss.&lt;/U&gt;&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
input code score ss $;&lt;BR /&gt;
cards;&lt;BR /&gt;
1944  .  &lt;BR /&gt;
1944  .  412&lt;BR /&gt;
959   548  417&lt;BR /&gt;
959    .    &lt;BR /&gt;
170   665  408&lt;BR /&gt;
170   659   &lt;BR /&gt;
171   581    &lt;BR /&gt;
171  580   183&lt;BR /&gt;
176   665   &lt;BR /&gt;
176  .    414&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks,</description>
      <pubDate>Wed, 31 Mar 2010 15:48:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72734#M15662</guid>
      <dc:creator>QLi</dc:creator>
      <dc:date>2010-03-31T15:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72735#M15663</link>
      <description>You might want to explain the layout of your CARDS (instream) data, such as how are the individual records organized and how you expect the output to appear, both in detail and after any data manipulation to meet your objectives.&lt;BR /&gt;
&lt;BR /&gt;
Suggest you reply to your post and paste a sample of the WORK.A file and also what you expect *AFTER* any additional SAS processing (possibly explaining your DATA step flow to help you with developing your SAS program).&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 31 Mar 2010 16:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72735#M15663</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-31T16:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72736#M15664</link>
      <description>Thanks for your response. &lt;BR /&gt;
&lt;BR /&gt;
The original data like this:&lt;BR /&gt;
input code   score    ss $;&lt;BR /&gt;
&lt;BR /&gt;
1944  .  &lt;BR /&gt;
1944  .     412&lt;BR /&gt;
959   548  417&lt;BR /&gt;
959    .    &lt;BR /&gt;
170   665  408&lt;BR /&gt;
170   659   &lt;BR /&gt;
171   581    &lt;BR /&gt;
171   580   183&lt;BR /&gt;
176   665   &lt;BR /&gt;
176    .    414&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I want to get dataset like this&lt;BR /&gt;
959   548   417&lt;BR /&gt;
170   659   408&lt;BR /&gt;
171   580   183&lt;BR /&gt;
176   665   414&lt;BR /&gt;
&lt;BR /&gt;
1st column code is doubled, I want to keep one unique code,&lt;BR /&gt;
&lt;BR /&gt;
2nd column is score, there are two scores for doubled code, and I want to pick the smaller one.&lt;BR /&gt;
&lt;BR /&gt;
3rd column is ss, there are one value and one missing for doubled code, and I want to pick non-missing value. &lt;BR /&gt;
&lt;BR /&gt;
Could you please help fix it out?&lt;BR /&gt;
&lt;BR /&gt;
Thanks very much!&lt;BR /&gt;
&lt;BR /&gt;
Qing</description>
      <pubDate>Wed, 31 Mar 2010 16:21:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72736#M15664</guid>
      <dc:creator>QLi</dc:creator>
      <dc:date>2010-03-31T16:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72737#M15665</link>
      <description>What happens to 1944 input data field/value?   Also, suggest you label your output columns to make no assumptions with your processing.&lt;BR /&gt;
&lt;BR /&gt;
Using a DATA step, you will likely need to input a field at a time and assign either a SAS CHARACTER or NUMERIC variable, possibly in a continuous DO/END loop to avoid needing to use a RETAIN statement.  You can use PUTLOG _ALL_ statements in your code to interrogate what SAS processing is doing as you develop your program.  And since you have multiple measurement values on one record, you will do an explicit OUTPUT statement.&lt;BR /&gt;
&lt;BR /&gt;
Then look at PROC MEANS or SUMMARY to generate an output for each unique CODE variable and a non-missing MIN value.&lt;BR /&gt;
&lt;BR /&gt;
No question that this can be done with a DATA step approach alone, but it may also be more straightforward to rely on a suitable SAS PROC, like MEANS.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
data step programming introduction site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
using proc summary site:sas.com</description>
      <pubDate>Wed, 31 Mar 2010 16:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72737#M15665</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-03-31T16:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72738#M15666</link>
      <description>First, look at the documentation for the infile statement.&lt;BR /&gt;
You do not have all fields in all lines so you will need an infile option like MISSOVER or TRUNCOVER.&lt;BR /&gt;
&lt;BR /&gt;
Second, I would recommend you use a three step approach.&lt;BR /&gt;
&lt;BR /&gt;
1)  Data step to read in the data.&lt;BR /&gt;
      if ss = . then delete;&lt;BR /&gt;
&lt;BR /&gt;
2)  PROC SORT data=_______; by u_code, s_value, ss;&lt;BR /&gt;
&lt;BR /&gt;
3) Data step to produce the desired set.&lt;BR /&gt;
&lt;BR /&gt;
Data last_step;&lt;BR /&gt;
  set in_data;&lt;BR /&gt;
  by u_code, s_value, ss;&lt;BR /&gt;
  if first.s_value then output;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 31 Mar 2010 17:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset/m-p/72738#M15666</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-31T17:15:13Z</dc:date>
    </item>
  </channel>
</rss>

