<?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 data set using card with dates values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955304#M373102</link>
    <description>&lt;P&gt;1) add MISSOVER&lt;/P&gt;
&lt;P&gt;2) remove DSD&lt;/P&gt;
&lt;P&gt;3) read the documentation for INFILE statement:&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
infile cards MISSOVER;
input custid date date9.  ind_change  balance;
format date date9.;
cards;
111 01JAN2025 0
111 02JAN2025 0
111 03JAN2025 0
111 04JAN2025 1
111 05JAN2025 0
111 06JAN2025 0
111 07JAN2025 0
111 08JAN2025 0
111 09JAN2025 1
111 10JAN2025 0
;
Run;

 
data have2;
infile datalines dlm=",";
input custid   date date9.  ind_change  balance;
format date date9.;
cards;
111,01JAN2025,0,50
111,02JAN2025,0,80
111,03JAN2025,0,10
111,04JAN2025,1,15
111,05JAN2025,0,30
111,06JAN2025,0,80
111,07JAN2025,0,90
111,08JAN2025,0,140
111,09JAN2025,1,130
111,10JAN2025,0,125
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 07 Jan 2025 12:52:17 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2025-01-07T12:52:17Z</dc:date>
    <item>
      <title>create data set using card with dates values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955298#M373098</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Why is wrong that these 2 data sets are not created well?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Data have1;
infile cards;
input CustID date date9.  Ind_Change  balance;
format date date9.;
cards;
111 01JAN2025 0
111 02JAN2025 0
111 03JAN2025 0
111 04JAN2025 1
111 05JAN2025 0
111 06JAN2025 0
111 07JAN2025 0
111 08JAN2025 0
111 09JAN2025 1
111 10JAN2025 0
;
Run;

 
Data have2;
infile datalines dlm="," dsd;
input CustID   date date9.  Ind_Change  balance;
format date date9.;
cards;
111,01JAN2025,0,50
111,02JAN2025,0,80
111,03JAN2025,0,10
111,04JAN2025,1,15
111,05JAN2025,0,30
111,06JAN2025,0,80
111,07JAN2025,0,90
111,08JAN2025,0,140
111,09JAN2025,1,130
111,10JAN2025,0,125
;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jan 2025 11:21:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955298#M373098</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-01-07T11:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: create data set using card with dates values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955303#M373101</link>
      <description>&lt;P&gt;Haven't tried your code, but I think you need an INFORMAT for your date variables.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 12:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955303#M373101</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-01-07T12:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: create data set using card with dates values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955304#M373102</link>
      <description>&lt;P&gt;1) add MISSOVER&lt;/P&gt;
&lt;P&gt;2) remove DSD&lt;/P&gt;
&lt;P&gt;3) read the documentation for INFILE statement:&amp;nbsp;&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
infile cards MISSOVER;
input custid date date9.  ind_change  balance;
format date date9.;
cards;
111 01JAN2025 0
111 02JAN2025 0
111 03JAN2025 0
111 04JAN2025 1
111 05JAN2025 0
111 06JAN2025 0
111 07JAN2025 0
111 08JAN2025 0
111 09JAN2025 1
111 10JAN2025 0
;
Run;

 
data have2;
infile datalines dlm=",";
input custid   date date9.  ind_change  balance;
format date date9.;
cards;
111,01JAN2025,0,50
111,02JAN2025,0,80
111,03JAN2025,0,10
111,04JAN2025,1,15
111,05JAN2025,0,30
111,06JAN2025,0,80
111,07JAN2025,0,90
111,08JAN2025,0,140
111,09JAN2025,1,130
111,10JAN2025,0,125
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jan 2025 12:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955304#M373102</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-01-07T12:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: create data set using card with dates values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955305#M373103</link>
      <description>&lt;P&gt;And if you really have DSD-data then use colon operator(:)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have2;
infile datalines dlm="," dsd;
input custid date :date9. ind_change balance XXX :$5.; /* XXX is really DSD-data */
format date date9.;
cards;
111,01JAN2025,0,50,"A,B"
;
Run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;B&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 13:02:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955305#M373103</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-01-07T13:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: create data set using card with dates values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955323#M373104</link>
      <description>&lt;P&gt;You almost NEVER want the functionality of the ancient MISSOVER option (to throw away values at the end of the line that are too short).&amp;nbsp; Instead use the &lt;STRONG&gt;TRUNCOVER&lt;/STRONG&gt; option (its only been available for the last 30 years).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is the need to continue to use of LIST MODE input style, which not use only when using DSD option on the infile statement, that requires the colon modifier in front of informat specifications included in the INPUT statement.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 16:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955323#M373104</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-07T16:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: create data set using card with dates values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955326#M373105</link>
      <description>&lt;P&gt;TRUNCOVER&lt;SPAN&gt;&amp;nbsp; - thanks Tom, will use it!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Bart&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 15:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955326#M373105</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2025-01-07T15:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: create data set using card with dates values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955363#M373123</link>
      <description>&lt;P&gt;For have1, you try to read four values, but only have three values in each CARDS line. The default FLOWOVER option causes the INPUT statement to read the first value of the following line as the fourth value, and discards the rest, so you miss half of the input lines. Use TRUNCOVER in an INFILE statement to prevent this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have1;
infile cards truncover;
input CustID date :date9. Ind_Change balance;
format date date9.;
cards;
111 01JAN2025 0
111 02JAN2025 0
111 03JAN2025 0
111 04JAN2025 1
111 05JAN2025 0
111 06JAN2025 0
111 07JAN2025 0
111 08JAN2025 0
111 09JAN2025 1
111 10JAN2025 0
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note the use of the colon modifier to prevent the INPUT statement from switching from &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/n0lrz3gb7m9e4rn137op544ddg0v.htm" target="_blank" rel="noopener"&gt;list input&lt;/A&gt; to &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/p0f9yk6pd4znukn1rlw6hzkg1url.htm" target="_blank" rel="noopener"&gt;formatted input&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For have2, once again you must use the colon modifier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have2;
infile datalines dlm="," dsd;
input CustID date :date9. Ind_Change balance;
format date date9.;
cards;
111,01JAN2025,0,50
111,02JAN2025,0,80
111,03JAN2025,0,10
111,04JAN2025,1,15
111,05JAN2025,0,30
111,06JAN2025,0,80
111,07JAN2025,0,90
111,08JAN2025,0,140
111,09JAN2025,1,130
111,10JAN2025,0,125
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Without it, formatted input reads the next 9 characters and disregards any delimiter. For the next (third) variable, the INPUT statement immediately finds a delimiter, which means (because of the DSD option) that a missing value is encountered. The third value is then read into the fourth variable, and the fourth value is discarded.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 19:08:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-data-set-using-card-with-dates-values/m-p/955363#M373123</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-01-07T19:08:47Z</dc:date>
    </item>
  </channel>
</rss>

