<?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 creating a date format variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-a-date-format-variable/m-p/800839#M315105</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dat;
length month 8 year 8 ;
input month year;
datalines;
2         2020
5         1992
10       2005
12       2012
4 1994
;
Data dat;
set dat;
format date DDMM10. mois1 $ 2. annee1 $4.;
mois1=put(month, 2.);
annee1=put(year, 4.);
date=mdy(input(mois1,DDMM10.),input(annee1,DDMM10.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have 2 numeric format variables month and year. The data is presented in the set dat. I want to calculate the date variable in date format taking into account only the month and the year, for example "Feb2020" or "02/2020".&lt;/P&gt;
&lt;P&gt;here is the code i made but i find the dots(.). I don't know why it doesn't work.&lt;/P&gt;
&lt;P&gt;I'm open to other suggestions too.&lt;/P&gt;
&lt;P&gt;Thank you&lt;BR /&gt;Gick&lt;/P&gt;</description>
    <pubDate>Tue, 08 Mar 2022 12:44:25 GMT</pubDate>
    <dc:creator>Gick</dc:creator>
    <dc:date>2022-03-08T12:44:25Z</dc:date>
    <item>
      <title>creating a date format variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-date-format-variable/m-p/800839#M315105</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dat;
length month 8 year 8 ;
input month year;
datalines;
2         2020
5         1992
10       2005
12       2012
4 1994
;
Data dat;
set dat;
format date DDMM10. mois1 $ 2. annee1 $4.;
mois1=put(month, 2.);
annee1=put(year, 4.);
date=mdy(input(mois1,DDMM10.),input(annee1,DDMM10.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have 2 numeric format variables month and year. The data is presented in the set dat. I want to calculate the date variable in date format taking into account only the month and the year, for example "Feb2020" or "02/2020".&lt;/P&gt;
&lt;P&gt;here is the code i made but i find the dots(.). I don't know why it doesn't work.&lt;/P&gt;
&lt;P&gt;I'm open to other suggestions too.&lt;/P&gt;
&lt;P&gt;Thank you&lt;BR /&gt;Gick&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 12:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-date-format-variable/m-p/800839#M315105</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2022-03-08T12:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: creating a date format variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-date-format-variable/m-p/800840#M315106</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set dat;
    date=mdy(month,1,year);
    format date monyy7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Mar 2022 12:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-date-format-variable/m-p/800840#M315106</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-08T12:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: creating a date format variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-date-format-variable/m-p/800854#M315115</link>
      <description>&lt;P&gt;The reason it does not work is pretty clearly explained by the error messages in the SAS log.&lt;/P&gt;
&lt;PRE&gt;1035  Data dat;
1036  set dat;
1037  format date DDMM10. mois1 $ 2. annee1 $4.;
                  -------
                  484
NOTE 484-185: Format DDMM was not found or could not be loaded.

1038  mois1=put(month, 2.);
1039  annee1=put(year, 4.);
1040  date=mdy(input(mois1,DDMM10.),input(annee1,DDMM10.));
                           -------               -------
                           485                   485
           ---
           71
NOTE 485-185: Informat DDMM was not found or could not be loaded.

ERROR 71-185: The MDY function call does not have enough arguments.

1041  run;
&lt;/PRE&gt;
&lt;P&gt;There is no format named DDMM nor any informat with that name either.&lt;/P&gt;
&lt;P&gt;The MDY() function requires three arguments, Month, Day and Year.&lt;/P&gt;
&lt;P&gt;Your dataset has Month and Year so you just need to pick some day in that month to be able to generate a date value.&amp;nbsp; Normally people use 1.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 14:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-date-format-variable/m-p/800854#M315115</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-08T14:25:39Z</dc:date>
    </item>
  </channel>
</rss>

