<?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 a new SAS dataset for people who born on or before Jan 1, 1960 in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640865#M21777</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have created the dob with mmddyy8. format.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The code you pasted above to create the data sets &lt;STRONG&gt;may not be&lt;/STRONG&gt; the code you executed. The main message windows on this forum reformat text. So the data steps shown above do not execute. Mainly because the @9 on the input statement does not align with the columns in the date after pasting in the message windows and so the id was "reading" 6 columns as numeric and failing because of the space between the single character and the Ses, date is read from the wrong columns and doesn't match the informat because column 9 is the middle of the day part of the value.&lt;/P&gt;
&lt;P&gt;Code should be pasted into a code box opened with either the &amp;lt;/&amp;gt; or "running man" icon to preserve spaces and such. Also tabs count differently than spaces and can be problematic between different systems.&lt;/P&gt;
&lt;P&gt;When I modify the pasted code above to and only use the first set&lt;/P&gt;
&lt;PRE&gt;data ONE;
input @1 id $ sex $1. dob :mmddyy8. salary;
format dob mmddyy8.;
datalines;
1 M 10/21/46 70000
2 F 11/01/55 68000
7 M 01/27/59 47000
;
run;
data EMP;
  set ONE ;
  if dob le '01JAN1960'd and salary ge 50000;
run;&lt;/PRE&gt;
&lt;P&gt;This extracts the two records with the income over 50000.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the Log I got from running the code for data one as shown above:&lt;/P&gt;
&lt;PRE&gt;165  data ONE;
166  input @1 id @6 sex $1. @9 dob mmddyy8. salary;
167  format dob mmddyy8.;
168  datalines;

NOTE: Invalid data for dob in line 169 9-16.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--
169        1 M 10/21/46 70000
id=1 sex=0 dob=. salary=0 _ERROR_=1 _N_=1
NOTE: Invalid data for dob in line 170 9-16.
170        2 F 11/01/55 68000
id=2 sex=1 dob=. salary=0 _ERROR_=1 _N_=2
NOTE: Invalid data for dob in line 171 9-16.
171        7 M 01/27/59 47000
id=7 sex=1 dob=. salary=0 _ERROR_=1 _N_=3
NOTE: The data set WORK.ONE has 3 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

&lt;/PRE&gt;
&lt;P&gt;If you look carefully you see that the value for SEX on the first line is 0 not the M expected. That is because the 6th character (after pasting in the message window) is the 0 form the 10/21/46.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Fri, 17 Apr 2020 21:42:38 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-04-17T21:42:38Z</dc:date>
    <item>
      <title>create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640833#M21767</link>
      <description>&lt;P&gt;data ONE;&lt;BR /&gt;input @1 id @6 sex $1. @9 dob mmddyy8. salary;&lt;BR /&gt;format dob mmddyy8.;&lt;BR /&gt;datalines;&lt;BR /&gt;1 M 10/21/46 70000&lt;BR /&gt;2 F 11/01/55 68000&lt;BR /&gt;7 M 01/27/59 47000&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data TWO;&lt;BR /&gt;input @1id @6 sex $1. @9 dob mmddyy8. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/131792"&gt;@19&lt;/a&gt; salary &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75109"&gt;@30&lt;/a&gt; taxrate @39withhold;&lt;BR /&gt;format dob mmddyy8.;&lt;BR /&gt;datalines;&lt;BR /&gt;3 F 01/01/33 78000 .36 23000&lt;BR /&gt;5 M 03/07/29 37000 .25 9000&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data THREE;&lt;BR /&gt;input @1 id @6 sex $1. @9 dob mmddyy8. @19salary &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/183164"&gt;@29&lt;/a&gt; height @39 weight;&lt;BR /&gt;format dob mmddyy8.;&lt;BR /&gt;datalines;&lt;BR /&gt;4 M 10/23/49 65000 68 158&lt;BR /&gt;6 F 07/04/65 55000 74 202&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data ALL (keep = id dob salary);&lt;BR /&gt;merge ONE TWO THREE;&lt;BR /&gt;by id;&lt;BR /&gt;proc print data = ALL;&lt;BR /&gt;title2'ALL';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Using the three datasets , write a program to create a new SAS dataset EMP for those people who born on or before Jan 1, 1960, and who earn $50,000 or more per year.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* Change dataset TWO, variable ID to IDNUM&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640833#M21767</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2020-04-17T20:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640837#M21768</link>
      <description>&lt;P&gt;If the question is how to compare a date valued variable to a specific date then you use the value quoted in date9 format followed by d.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if dob le '01JAN1960'd and salary ge 50000;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640837#M21768</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-17T20:18:17Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640838#M21769</link>
      <description>&lt;P&gt;Please show us the code you tried, and tell us why it did not meet your expectations; use the "little running man" to post the code.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640838#M21769</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-17T20:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640843#M21771</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;people who born on or before Jan 1, 1960, and who earn $50,000 or more per year. */

data EMP;
  set ONE TWO(RENAME =(ID = IDNUM)) THREE;
  if dob le '01JAN1960'd and salary ge 50000;
proc print data = EMP;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/38397iC91FF0CC7C81BF31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;i want to create a dataset who are born on or before jan 1, 1960 with income gt 50000. but it gives me blanks in obs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640843#M21771</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2020-04-17T20:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640846#M21772</link>
      <description>&lt;P&gt;when i try doing so,&amp;nbsp; i am getting blank obs in my o/p.&lt;/P&gt;&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data EMP;
  set ONE TWO(RENAME =(ID = IDNUM)) THREE;
  if dob le '01JAN1960'd and salary ge 50000;
proc print data = EMP;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/38398i08688C639315BC8E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640846#M21772</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2020-04-17T20:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640848#M21773</link>
      <description>&lt;P&gt;Is DOB variable a character variable or numeric variable.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640848#M21773</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-04-17T20:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640850#M21774</link>
      <description>&lt;P&gt;I have created the dob with mmddyy8. format.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2020 20:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640850#M21774</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2020-04-17T20:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640865#M21777</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have created the dob with mmddyy8. format.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The code you pasted above to create the data sets &lt;STRONG&gt;may not be&lt;/STRONG&gt; the code you executed. The main message windows on this forum reformat text. So the data steps shown above do not execute. Mainly because the @9 on the input statement does not align with the columns in the date after pasting in the message windows and so the id was "reading" 6 columns as numeric and failing because of the space between the single character and the Ses, date is read from the wrong columns and doesn't match the informat because column 9 is the middle of the day part of the value.&lt;/P&gt;
&lt;P&gt;Code should be pasted into a code box opened with either the &amp;lt;/&amp;gt; or "running man" icon to preserve spaces and such. Also tabs count differently than spaces and can be problematic between different systems.&lt;/P&gt;
&lt;P&gt;When I modify the pasted code above to and only use the first set&lt;/P&gt;
&lt;PRE&gt;data ONE;
input @1 id $ sex $1. dob :mmddyy8. salary;
format dob mmddyy8.;
datalines;
1 M 10/21/46 70000
2 F 11/01/55 68000
7 M 01/27/59 47000
;
run;
data EMP;
  set ONE ;
  if dob le '01JAN1960'd and salary ge 50000;
run;&lt;/PRE&gt;
&lt;P&gt;This extracts the two records with the income over 50000.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the Log I got from running the code for data one as shown above:&lt;/P&gt;
&lt;PRE&gt;165  data ONE;
166  input @1 id @6 sex $1. @9 dob mmddyy8. salary;
167  format dob mmddyy8.;
168  datalines;

NOTE: Invalid data for dob in line 169 9-16.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--
169        1 M 10/21/46 70000
id=1 sex=0 dob=. salary=0 _ERROR_=1 _N_=1
NOTE: Invalid data for dob in line 170 9-16.
170        2 F 11/01/55 68000
id=2 sex=1 dob=. salary=0 _ERROR_=1 _N_=2
NOTE: Invalid data for dob in line 171 9-16.
171        7 M 01/27/59 47000
id=7 sex=1 dob=. salary=0 _ERROR_=1 _N_=3
NOTE: The data set WORK.ONE has 3 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

&lt;/PRE&gt;
&lt;P&gt;If you look carefully you see that the value for SEX on the first line is 0 not the M expected. That is because the 6th character (after pasting in the message window) is the 0 form the 10/21/46.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 17 Apr 2020 21:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640865#M21777</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-17T21:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640981#M21802</link>
      <description>&lt;P&gt;why did you gave variable id as character ?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2020 17:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640981#M21802</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2020-04-18T17:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: create a new SAS dataset for people who born on or before Jan 1, 1960</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640983#M21803</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;why did you gave variable id as character ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Because one does not do calculations with identification numbers, and character variables are better to handle.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Apr 2020 17:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-a-new-SAS-dataset-for-people-who-born-on-or-before-Jan-1/m-p/640983#M21803</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-18T17:59:56Z</dc:date>
    </item>
  </channel>
</rss>

