<?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 do I change dates in a dataset into several rows with years? in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376886#M11471</link>
    <description>&lt;P&gt;First of all,&lt;/P&gt;
&lt;P&gt;"it didn't work"&lt;/P&gt;
&lt;P&gt;is about as informative as&lt;/P&gt;
&lt;P&gt;"as sack of rice dropped in China"&lt;/P&gt;
&lt;P&gt;!&lt;/P&gt;
&lt;P&gt;Post the log of a failed step, and in case there are no ERRORs or WARNINGs, describe how the result differed from what you expected.&lt;/P&gt;
&lt;P&gt;Second, the variable claimyear is created by the do loop, and does not have to be there at all before the step runs.&lt;/P&gt;
&lt;P&gt;When testing, I found that you posted bogus example data; there can never be a 31st of April!&lt;/P&gt;
&lt;P&gt;Now see this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input InsNr $ StartDate $ EndDate $;
cards;
112233               20010409          20030430
112233               20030501          20060808
112233               20060809          20100502
223344               20070812          20091010
223344               20091011          20151118
;
run;

data want (keep=insnr claimyear);
set have;
do claimyear = year(input(startdate,yymmdd8.)) to year(input(enddate,yymmdd8.));
  output;
end;
run;

proc sort data=want nodupkey;
by insnr claimyear;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;InsNr     claimyear

112233       2001  
112233       2002  
112233       2003  
112233       2004  
112233       2005  
112233       2006  
112233       2007  
112233       2008  
112233       2009  
112233       2010  
223344       2007  
223344       2008  
223344       2009  
223344       2010  
223344       2011  
223344       2012  
223344       2013  
223344       2014  
223344       2015  
&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Jul 2017 07:35:33 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-07-18T07:35:33Z</dc:date>
    <item>
      <title>How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376502#M11455</link>
      <description>&lt;P&gt;Hi! I’m quite new to SAS 9.4&amp;nbsp;and would need som help to solve a problem. I have a dataset that contains insurance-ID, year when the insurance started to and year when it ended. But everytime something happened (like a claim) there is a new row with a new period. So it looks something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;InsNr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StartDate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EndDate&lt;/P&gt;&lt;P&gt;112233 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20010409&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20030431&lt;BR /&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20030501&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20060808&lt;BR /&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20060809&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20100502&lt;BR /&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20070812&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20091010&lt;BR /&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20091011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20151118&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I would like one row for each year the insurance has been active. Like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;InsNr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ClaimYear&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2001&lt;BR /&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2002&lt;BR /&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2003&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2004&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2005&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2006&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2007&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2009&lt;/P&gt;&lt;P&gt;112233&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2010&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2007&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2008&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2009&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2010&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2012&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2013&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2014&lt;/P&gt;&lt;P&gt;223344&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don’t know where to start actually, I’ve tried some things, but it didn’t seem to lead anywhere. I’m thankful for all help or ideas on this, Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 11:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376502#M11455</guid>
      <dc:creator>AnnieFrannie</dc:creator>
      <dc:date>2017-07-17T11:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376505#M11456</link>
      <description>&lt;P&gt;Use a do loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep=insnr claimyear);
set have;
do claimyear = year(input(startdate,yymmdd8.)) to year(input(enddate,yymmdd8.));
  output;
end;
run;

proc sort data=want nodupkey;
by insnr claimyear;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The second step eliminates doubles caused by breaks not happening on dec 31.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 11:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376505#M11456</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-17T11:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376883#M11470</link>
      <description>&lt;P&gt;Thank you for your response.&lt;BR /&gt;I tried your code. Unfortunately, It didn't work. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; My dataset does not contain the variable ClaimYear yet, it is a variable that I wan't to create instead of StartDate and EndDate.&lt;/P&gt;&lt;P&gt;Now I've added two new columns in the data set that only contain the years from StartDate and EndDate (I thought it might be easier):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;set "C:/blablabla...";&lt;/P&gt;&lt;P&gt;StartYear=substrn(StartDate,1,4);&lt;/P&gt;&lt;P&gt;EndYear=substrn(EndDate,1,4);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I somehow use DO here too?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 07:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376883#M11470</guid>
      <dc:creator>AnnieFrannie</dc:creator>
      <dc:date>2017-07-18T07:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376886#M11471</link>
      <description>&lt;P&gt;First of all,&lt;/P&gt;
&lt;P&gt;"it didn't work"&lt;/P&gt;
&lt;P&gt;is about as informative as&lt;/P&gt;
&lt;P&gt;"as sack of rice dropped in China"&lt;/P&gt;
&lt;P&gt;!&lt;/P&gt;
&lt;P&gt;Post the log of a failed step, and in case there are no ERRORs or WARNINGs, describe how the result differed from what you expected.&lt;/P&gt;
&lt;P&gt;Second, the variable claimyear is created by the do loop, and does not have to be there at all before the step runs.&lt;/P&gt;
&lt;P&gt;When testing, I found that you posted bogus example data; there can never be a 31st of April!&lt;/P&gt;
&lt;P&gt;Now see this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input InsNr $ StartDate $ EndDate $;
cards;
112233               20010409          20030430
112233               20030501          20060808
112233               20060809          20100502
223344               20070812          20091010
223344               20091011          20151118
;
run;

data want (keep=insnr claimyear);
set have;
do claimyear = year(input(startdate,yymmdd8.)) to year(input(enddate,yymmdd8.));
  output;
end;
run;

proc sort data=want nodupkey;
by insnr claimyear;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;InsNr     claimyear

112233       2001  
112233       2002  
112233       2003  
112233       2004  
112233       2005  
112233       2006  
112233       2007  
112233       2008  
112233       2009  
112233       2010  
223344       2007  
223344       2008  
223344       2009  
223344       2010  
223344       2011  
223344       2012  
223344       2013  
223344       2014  
223344       2015  
&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jul 2017 07:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376886#M11471</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-18T07:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376890#M11472</link>
      <description>&lt;P&gt;Thank you for your answer.&lt;BR /&gt;I'm sorry, I'm new here. And yes I was a&amp;nbsp;little too hasty when I created the example data it seems.&lt;BR /&gt;But I will try my best&amp;nbsp;to be more informative, here is the log where the error ocurred (english isn't my mother's tongue so the variables has other names in my program, but it means the same thing):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: The data set WORK.PREMIER has 134077 observations and 10 variables.
 NOTE: DATA statement used (Total process time):
       real time           4.13 seconds
       cpu time            0.18 seconds
       

 
 83         data premier2 (keep=Forsnr SkadeAr);
 84         set premier;
 85         do SkadeAr = year(input(begynnelsedatum,yymmdd8.)) to
 85       ! year(input(forfallodatum,yymmdd8.));
 86           output;
 87         end;
 88         run;
 
 NOTE: Numeric values have been converted to character values at the places given by: 
       (Line):(Column).
       85:25   85:66   
 NOTE: Invalid argument to function INPUT at line 85 column 60.
 NOTE: Invalid argument to function INPUT at line 85 column 19.
 ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the 
        BY expression is missing, zero, or invalid.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Jul 2017 08:08:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376890#M11472</guid>
      <dc:creator>AnnieFrannie</dc:creator>
      <dc:date>2017-07-18T08:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376893#M11473</link>
      <description>&lt;P&gt;This is why we usually ask to post example datasets in a data step. Use the macro provided in&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; to convert your dataset to a data step that can be posted in a code window. This method will preserve the dataset structure and the data as is, so we don't have to make guesses about variable types and formats from data that is just displayed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, I made the assumption that your dates are still character, which was obviously wrong.&lt;/P&gt;
&lt;P&gt;So omit the input functions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep=insnr claimyear);
set have;
do claimyear = year(startdate) to year(enddate);
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This of course assumes that you really have SAS date values (days from 01-01-1960, formatted with a SAS date format) and not just some numbers that look like dates.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 08:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376893#M11473</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-18T08:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376924#M11475</link>
      <description>&lt;P&gt;Thank you for your answer and information about how to generate data for forums. I appreciate it.&lt;BR /&gt;I think that the dates are&amp;nbsp;just numbers to SAS, because the data originally comes from another system.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 10:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376924#M11475</guid>
      <dc:creator>AnnieFrannie</dc:creator>
      <dc:date>2017-07-18T10:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change dates in a dataset into several rows with years?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376945#M11476</link>
      <description>&lt;P&gt;Now if a date is stored as a number that &lt;EM&gt;looks&lt;/EM&gt; like a date, eg 20170717 (20 million 170 thousand 717), that should be converted to a real SAS date value as early as possible in your analytics chain, preferrably when you read external data. How you do that depends on how data is delivered to you (connection to database, text file, Excel (yucc) file, ...).&lt;/P&gt;
&lt;P&gt;If you have a number like that, convert it like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;startdate = input(put(startdate,8.),yymmdd8.);
format startdate yymmddn8.; /* variable will look the same, but have a different internal value */
format startdate date9.; /* the standard SAS date notation */
format startdate yymmddd8.; /* ISO-compliant notation, used in databases */
format startdate ddmmyyp10.; /* typical in Germany */
format startdate mmddyy10.; /* US and UK */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use one of the formats that suits you.&lt;/P&gt;
&lt;P&gt;Do a Google search for "SAS date values", and one of the first hits will be this &lt;A href="https://support.sas.com/resources/papers/proceedings15/1334-2015.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings15/1334-2015.pdf&lt;/A&gt;, which is a very good paper about how SAS stores date and time values, and how you import, handle and display/export them.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 11:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-do-I-change-dates-in-a-dataset-into-several-rows-with-years/m-p/376945#M11476</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-18T11:48:53Z</dc:date>
    </item>
  </channel>
</rss>

