<?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: properly Import the .csv file with date into SAS in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700107#M25681</link>
    <description>&lt;P&gt;Nothing's added:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data My_data;
infile datalines dlm="," dsd firstobs=2 truncover;
input id :$11. gender :$8. birth_year_and_month :yymmn.;
format birth_year_and_month yymmn.;
datalines;
"ID","GENDER","BIRTH YEAR AND MONTH"
"M0058","Female","196106"
"M00123","Male","195108"
"M00331","Male","196002"
"M00366","Female","195001"
"M00440","Female","195607"
"M00458","Female","196501"
"M00584","Female","197902"
"M00611","Male","196601"
"M00673","Female","194306"
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The YYMMN informat will set the date to the first of the month. A date is a date is a date, specifying a certain day within a certain month within a certain year. ALWAYS.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Nov 2020 06:08:25 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-11-19T06:08:25Z</dc:date>
    <item>
      <title>properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/699796#M25659</link>
      <description>&lt;P&gt;Hello, everyone, I would like to properly import a CSV file which has the date in the following format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"ID","GENDER","BIRTH YEAR AND MONTH"
"M0058","Female","196106"
"M00123","Male","195108"
"M00331","Male","196002"
"M00366","Female","195001"
"M00440","Female","195607"
"M00458","Female","196501"
"M00584","Female","197902"
"M00611","Male","196601"
"M00673","Female","194306"
&lt;/PRE&gt;
&lt;P&gt;Once I import this file, I would like to calculate the difference between the dates in this format and another date which looks like 2020-11-18 (YYMMDD10. format)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: (2020-11-18) - (196106)&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 14:02:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/699796#M25659</guid>
      <dc:creator>mantubiradar19</dc:creator>
      <dc:date>2020-11-18T14:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/699811#M25661</link>
      <description>&lt;P&gt;To convert those strings into dates you can use the YYMMN informat.&amp;nbsp; Once you have date values it does not matter what format you are using to display them.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile example dsd firstobs=2 truncover ;
  input id :$10. gender :$6. birthym :yymmn.;
  format birthym yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs      id      gender       birthym

 1     M0058     Female    1961-06-01
 2     M00123    Male      1951-08-01
 3     M00331    Male      1960-02-01
 4     M00366    Female    1950-01-01
 5     M00440    Female    1956-07-01
 6     M00458    Female    1965-01-01
 7     M00584    Female    1979-02-01
 8     M00611    Male      1966-01-01
 9     M00673    Female    1943-06-01

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 14:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/699811#M25661</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-18T14:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/699825#M25662</link>
      <description>&lt;P&gt;DATE implies a day of month as well, which will be important if you want of calculate intervals.&lt;/P&gt;
&lt;P&gt;Which day of the month should be used as a default for those "dates"?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 15:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/699825#M25662</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-18T15:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700080#M25676</link>
      <description>Let me try this tom</description>
      <pubDate>Thu, 19 Nov 2020 03:13:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700080#M25676</guid>
      <dc:creator>mantubiradar19</dc:creator>
      <dc:date>2020-11-19T03:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700081#M25677</link>
      <description>I would like to calculate the interval using only the YEAR. Ex: 2020 - 1961 for my first observation</description>
      <pubDate>Thu, 19 Nov 2020 03:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700081#M25677</guid>
      <dc:creator>mantubiradar19</dc:creator>
      <dc:date>2020-11-19T03:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700095#M25678</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16379"&gt;@mantubiradar19&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I would like to calculate the interval using only the YEAR. Ex: 2020 - 1961 for my first observation&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you only need a year difference, the day of the month should be irrelevant.&lt;/P&gt;
&lt;P&gt;Use the YYMMN6. informat to read the data, and then the INTCK or YRDIF function to compare two dates; if the second value is year-only, extract the year from the date with the YEAR function.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 05:20:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700095#M25678</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-19T05:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700103#M25680</link>
      <description>If I use the following code, the date of "1" gets added to the birthym&lt;BR /&gt;&lt;BR /&gt;data My_data;&lt;BR /&gt;  infile "My_data.csv" dsd firstobs=2 truncover ;&lt;BR /&gt;  input ID :$11. GENDER :$8. BIRTH_YEAR_AND_MONTH :yymmn.;&lt;BR /&gt;  format BIRTH_YEAR_AND_MONTH yymmdd10.;&lt;BR /&gt;run;quit;&lt;BR /&gt;&lt;BR /&gt;So, I should just change ":yymmn." to ":YYMMN6." right?</description>
      <pubDate>Thu, 19 Nov 2020 05:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700103#M25680</guid>
      <dc:creator>mantubiradar19</dc:creator>
      <dc:date>2020-11-19T05:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700107#M25681</link>
      <description>&lt;P&gt;Nothing's added:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data My_data;
infile datalines dlm="," dsd firstobs=2 truncover;
input id :$11. gender :$8. birth_year_and_month :yymmn.;
format birth_year_and_month yymmn.;
datalines;
"ID","GENDER","BIRTH YEAR AND MONTH"
"M0058","Female","196106"
"M00123","Male","195108"
"M00331","Male","196002"
"M00366","Female","195001"
"M00440","Female","195607"
"M00458","Female","196501"
"M00584","Female","197902"
"M00611","Male","196601"
"M00673","Female","194306"
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The YYMMN informat will set the date to the first of the month. A date is a date is a date, specifying a certain day within a certain month within a certain year. ALWAYS.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 06:08:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700107#M25681</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-19T06:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: properly Import the .csv file with date into SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700111#M25682</link>
      <description>Thank you, Mr. Kurt</description>
      <pubDate>Thu, 19 Nov 2020 06:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/properly-Import-the-csv-file-with-date-into-SAS/m-p/700111#M25682</guid>
      <dc:creator>mantubiradar19</dc:creator>
      <dc:date>2020-11-19T06:30:17Z</dc:date>
    </item>
  </channel>
</rss>

