<?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: reading data in data step/input in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347402#M80238</link>
    <description>&lt;P&gt;Please note that your data lines to &lt;STRONG&gt;not&lt;/STRONG&gt; have a value for the value variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QD_VRcomgap_stb_lb10_ord3_d1_x&lt;/P&gt;
&lt;P&gt;DW_VRcomgap_stb_lb6_ord3_d1_y&lt;/P&gt;
&lt;P&gt;there is not second value on either of these lines.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Apr 2017 14:52:02 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-04-05T14:52:02Z</dc:date>
    <item>
      <title>reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347399#M80237</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I cannot get SAS read the datalines below correctly into SAS file.&lt;/P&gt;
&lt;P&gt;The record 4 and 5 have blank or missing value.&lt;/P&gt;
&lt;P&gt;Can anyone help me with that?&lt;/P&gt;
&lt;P&gt;Thank you so much.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data F3_final_list;
input name $32. value;

datalines;
D_VR_comgap_stb_lb6_ord3_d2_x1	100
D_W_VR_comgap_lb10_stb_cd_xac123	2 
D_std90_gt_90	0
QD_VRcomgap_stb_lb10_ord3_d1_x	
DW_VRcomgap_stb_lb6_ord3_d1_y	
D_sys2_cnt_trend_prior	0
;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Apr 2017 14:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347399#M80237</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-04-05T14:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347402#M80238</link>
      <description>&lt;P&gt;Please note that your data lines to &lt;STRONG&gt;not&lt;/STRONG&gt; have a value for the value variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QD_VRcomgap_stb_lb10_ord3_d1_x&lt;/P&gt;
&lt;P&gt;DW_VRcomgap_stb_lb6_ord3_d1_y&lt;/P&gt;
&lt;P&gt;there is not second value on either of these lines.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 14:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347402#M80238</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-05T14:52:02Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347418#M80241</link>
      <description>&lt;P&gt;Do you mean the dsd option:&lt;/P&gt;
&lt;PRE&gt;data F3_final_list;
  infile datalines dsd;
  input name $32. value;
datalines;
D_VR_comgap_stb_lb6_ord3_d2_x1	100
D_W_VR_comgap_lb10_stb_cd_xac123	2 
D_std90_gt_90	0
QD_VRcomgap_stb_lb10_ord3_d1_x	
DW_VRcomgap_stb_lb6_ord3_d1_y	
D_sys2_cnt_trend_prior	0
;run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Apr 2017 15:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347418#M80241</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-05T15:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347432#M80251</link>
      <description>&lt;P&gt;The instruction $32. is incorrect.&amp;nbsp; It tells SAS to read 32 characters, regardless of whether they are blanks or characters following blanks.&amp;nbsp; A better way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length name $ 32;&lt;/P&gt;
&lt;P&gt;input name value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, since some lines do not contain value, this statement belongs before the INPUT statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;infile datalines truncover;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 15:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347432#M80251</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-05T15:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347483#M80279</link>
      <description>&lt;PRE&gt;When to use 'input; _infile_' combinations&lt;BR /&gt;&lt;BR /&gt;this post&lt;BR /&gt;https://goo.gl/pv00gD&lt;BR /&gt;https://communities.sas.com/t5/forums/replypage/board-id/programming/message-id/80251&lt;BR /&gt;&lt;BR /&gt;HAVE (missing data, oddly spaced data and unknown variable lengths in a SAS interactive old text editor)&lt;BR /&gt;=========================================================================================================&lt;BR /&gt;&lt;BR /&gt;Because editors like EE, EG, SAS Studio are inconsistent with inline data, you may want stick with just one.&lt;BR /&gt;Line lengths, how blank lines are processed and '.' vary from editor to editor.&lt;BR /&gt;I like to stick with the 'old text editor', which was rock solid prior to 1984, but is d&lt;EM&gt;eteriorating&lt;/EM&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HAVE&lt;BR /&gt;====&lt;BR /&gt;&lt;BR /&gt;cards4;&lt;BR /&gt;D_VR_comgap_stb_lb6_ord3_d2_x1 100&lt;BR /&gt;D_W_VR_comgap_lb10_stb_cd_xac123 2&lt;BR /&gt;D_std90_gt_90 0&lt;BR /&gt;Q .&lt;BR /&gt;S .&lt;BR /&gt;QD_VRcomgap_stb_lb10_ord3_d1_x&lt;BR /&gt;DW_VRcomgap_stb_lb6_ord3_d1_y&lt;BR /&gt;D_sys2_cnt_trend_prior 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;WANT&lt;BR /&gt;====&lt;BR /&gt;&lt;BR /&gt;Up to 40 obs WORK.F3_FINAL_LIST total obs=8&lt;BR /&gt;&lt;BR /&gt;Obs NAME VALUE&lt;BR /&gt;&lt;BR /&gt; 1 D_VR_comgap_stb_lb6_ord3_d2_x1 100&lt;BR /&gt; 2 D_W_VR_comgap_lb10_stb_cd_xac123 2&lt;BR /&gt; 3 D_std90_gt_90 0&lt;BR /&gt; 4 Q .&lt;BR /&gt; 5 S .&lt;BR /&gt; 6 QD_VRcomgap_stb_lb10_ord3_d1_x .&lt;BR /&gt; 7 DW_VRcomgap_stb_lb6_ord3_d1_y .&lt;BR /&gt; 8 D_sys2_cnt_trend_prior 0&lt;BR /&gt;&lt;BR /&gt;WORKING CODE&lt;BR /&gt;============&lt;BR /&gt; input;&lt;BR /&gt; name=scan(_infile_,1,' ');&lt;BR /&gt; value=input(scan(_infile_,2,' '),4.);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FULL SOLUTION&lt;BR /&gt;=============&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data F3_final_list;&lt;BR /&gt; length name $384 ; * longest editor line in old text editor;&lt;BR /&gt; input;&lt;BR /&gt; name=scan(_infile_,1,' ');&lt;BR /&gt; value=input(scan(_infile_,2,' '),4.);&lt;BR /&gt;cards4;&lt;BR /&gt;D_VR_comgap_stb_lb6_ord3_d2_x1 100&lt;BR /&gt;D_W_VR_comgap_lb10_stb_cd_xac123 2&lt;BR /&gt;D_std90_gt_90 0&lt;BR /&gt;Q .&lt;BR /&gt;S .&lt;BR /&gt;QD_VRcomgap_stb_lb10_ord3_d1_x&lt;BR /&gt;DW_VRcomgap_stb_lb6_ord3_d1_y&lt;BR /&gt;D_sys2_cnt_trend_prior 0&lt;BR /&gt;;;;;&lt;BR /&gt;run;quit;&lt;BR /&gt;&lt;BR /&gt;2735 data F3_final_list;&lt;BR /&gt;2736 length name $384 ; * longest editor line in old text editor;&lt;BR /&gt;2737 input;&lt;BR /&gt;2738 name=scan(_infile_,1,' ');&lt;BR /&gt;2739 value=input(scan(_infile_,2,' '),4.);&lt;BR /&gt;2740 cards4;&lt;BR /&gt;&lt;BR /&gt;NOTE: The data set WORK.F3_FINAL_LIST has 8 observations and 2 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In the old text editor&lt;BR /&gt;If you save this in your autocall library and turn on the command macros, 'options cmdmac;'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hight light the cards data and type 'cuth' on the clean old text editor command line&lt;BR /&gt;&lt;BR /&gt;%macro cuth/cmd;&lt;BR /&gt; %do i=1 %to 20;&lt;BR /&gt; c ' ' ' ' all;&lt;BR /&gt; %end;&lt;BR /&gt;%mend cuth;&lt;BR /&gt;&lt;BR /&gt;You can also use a function key ie 'F1 cuth'&lt;BR /&gt;&lt;BR /&gt;HIGHLIGHT THIS&lt;BR /&gt;&lt;BR /&gt;D_VR_comgap_stb_lb6_ord3_d2_x1 100&lt;BR /&gt;D_W_VR_comgap_lb10_stb_cd_xac123 2&lt;BR /&gt;D_std90_gt_90 0&lt;BR /&gt;Q .&lt;BR /&gt;S .&lt;BR /&gt;QD_VRcomgap_stb_lb10_ord3_d1_x&lt;BR /&gt;DW_VRcomgap_stb_lb6_ord3_d1_y&lt;BR /&gt;D_sys2_cnt_trend_prior 0&lt;BR /&gt;&lt;BR /&gt;YOU GET THIS&lt;BR /&gt;&lt;BR /&gt;D_VR_comgap_stb_lb6_ord3_d2_x1 100&lt;BR /&gt;D_W_VR_comgap_lb10_stb_cd_xac123 2&lt;BR /&gt;D_std90_gt_90 0&lt;BR /&gt;Q .&lt;BR /&gt;S .&lt;BR /&gt;QD_VRcomgap_stb_lb10_ord3_d1_x&lt;BR /&gt;DW_VRcomgap_stb_lb6_ord3_d1_y&lt;BR /&gt;D_sys2_cnt_trend_prior 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2734 run;quit;&lt;BR /&gt;MLOGIC(CUTH): Beginning execution.&lt;BR /&gt;MLOGIC(CUTH): This macro was compiled from the autocall file c:\oto\cuth.sas&lt;BR /&gt;MLOGIC(CUTH): %DO loop beginning; index variable I; start value is 1; stop value is 20; by value is 1.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 2; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 3; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 4; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 5; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 6; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 7; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 8; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 9; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 10; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 11; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 12; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 13; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 14; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 15; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 16; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 17; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 18; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 19; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 20; loop will iterate again.&lt;BR /&gt;MLOGIC(CUTH): %DO loop index variable I is now 21; loop will not iterate again.&lt;BR /&gt;MLOGIC(CUTH): Ending execution.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Apr 2017 18:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347483#M80279</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-04-05T18:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347484#M80280</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;When to use 'input; _infile_' combinations

formatting not working this is a retry

see
https://goo.gl/pv00gD
https://communities.sas.com/t5/forums/replypage/board-id/programming/message-id/80251

HAVE  (missing data, oddly spaced data and unknown variable lengths in a SAS interactive old text editor)
=========================================================================================================

Because editors like EE, EG, SAS Studio are inconsistent with inline data, you may want stick with just one.
Line lengths, how blank lines are processed and '.' may vary.
I like to stick with the 'old text editor', which was rock solid prior to 1984?


HAVE
====

cards4;

D_VR_comgap_stb_lb6_ord3_d2_x1      100
D_W_VR_comgap_lb10_stb_cd_xac123                        2
D_std90_gt_90  0
Q .
S                   .
QD_VRcomgap_stb_lb10_ord3_d1_x
DW_VRcomgap_stb_lb6_ord3_d1_y
D_sys2_cnt_trend_prior                        0


WANT
====

Up to 40 obs WORK.F3_FINAL_LIST total obs=8

Obs    NAME                                VALUE

 1     D_VR_comgap_stb_lb6_ord3_d2_x1       100
 2     D_W_VR_comgap_lb10_stb_cd_xac123       2
 3     D_std90_gt_90                          0
 4     Q                                      .
 5     S                                      .
 6     QD_VRcomgap_stb_lb10_ord3_d1_x         .
 7     DW_VRcomgap_stb_lb6_ord3_d1_y          .
 8     D_sys2_cnt_trend_prior                 0

WORKING CODE
============
   input;
   name=scan(_infile_,1,' ');
   value=input(scan(_infile_,2,' '),4.);


FULL SOLUTION
=============


data F3_final_list;
  length name  $384 ; * longest editor line in old text editor;
  input;
  name=scan(_infile_,1,' ');
  value=input(scan(_infile_,2,' '),4.);
cards4;
D_VR_comgap_stb_lb6_ord3_d2_x1      100
D_W_VR_comgap_lb10_stb_cd_xac123                        2
D_std90_gt_90  0
Q .
S                   .
QD_VRcomgap_stb_lb10_ord3_d1_x
DW_VRcomgap_stb_lb6_ord3_d1_y
D_sys2_cnt_trend_prior                        0
;;;;
run;quit;

2735  data F3_final_list;
2736    length name  $384 ; * longest editor line in old text editor;
2737    input;
2738    name=scan(_infile_,1,' ');
2739    value=input(scan(_infile_,2,' '),4.);
2740  cards4;

NOTE: The data set WORK.F3_FINAL_LIST has 8 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds


In the old text editor
If you save this in your autocall library and turn on the command macros, 'options cmdmac;'


Hight light the cards data and type 'cuth' on the clean old text editor command line

%macro cuth/cmd;
  %do i=1 %to 20;
    c '  ' ' ' all;
  %end;
%mend cuth;

You can also use a function key   ie  'F1  cuth'

HIGHLIGHT THIS

D_VR_comgap_stb_lb6_ord3_d2_x1      100
D_W_VR_comgap_lb10_stb_cd_xac123                        2
D_std90_gt_90  0
Q .
S                   .
QD_VRcomgap_stb_lb10_ord3_d1_x
DW_VRcomgap_stb_lb6_ord3_d1_y
D_sys2_cnt_trend_prior                        0

YOU GET THIS

D_VR_comgap_stb_lb6_ord3_d2_x1 100
D_W_VR_comgap_lb10_stb_cd_xac123 2
D_std90_gt_90 0
Q .
S .
QD_VRcomgap_stb_lb10_ord3_d1_x
DW_VRcomgap_stb_lb6_ord3_d1_y
D_sys2_cnt_trend_prior 0


2734  run;quit;
MLOGIC(CUTH):  Beginning execution.
MLOGIC(CUTH):  This macro was compiled from the autocall file c:\oto\cuth.sas
MLOGIC(CUTH):  %DO loop beginning; index variable I; start value is 1; stop value is 20; by value is 1.
MLOGIC(CUTH):  %DO loop index variable I is now 2; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 3; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 4; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 5; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 6; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 7; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 8; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 9; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 10; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 11; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 12; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 13; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 14; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 15; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 16; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 17; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 18; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 19; loop will iterate again.
MLOGIC(CUTH): %DO loop index variable I is now 20; loop will iterate again.
MLOGIC(CUTH):  %DO loop index variable I is now 21; loop will not iterate again.
MLOGIC(CUTH):  Ending execution.



&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Apr 2017 18:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347484#M80280</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-04-05T18:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347713#M80389</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data F3_final_list;
infile datalines truncover;
input name : $32. value;
datalines;
D_VR_comgap_stb_lb6_ord3_d2_x1	100
D_W_VR_comgap_lb10_stb_cd_xac123	2 
D_std90_gt_90	0
QD_VRcomgap_stb_lb10_ord3_d1_x	
DW_VRcomgap_stb_lb6_ord3_d1_y	
D_sys2_cnt_trend_prior	0
;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Apr 2017 13:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/347713#M80389</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-06T13:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data step/input</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/348124#M80572</link>
      <description>&lt;P&gt;Thank you so much.&lt;/P&gt;
&lt;P&gt;Both codes work nicely.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 14:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-step-input/m-p/348124#M80572</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-04-07T14:38:43Z</dc:date>
    </item>
  </channel>
</rss>

