0

Here are a few lines of data.

q  2016 55 59  580067.12 89453.03 74579.31 63005.34 54211.66
q  2016 60 64  826983.94119020.88 99145.49 85347.23 75223.34
q  2016 65 69 1080400.00139847.91116260.10103226.14 93063.24 
q  2016 70 74 1086917.25120158.78100291.15 91782.05 85081.34

I saved that in a file called "junk.txt". The follow bits of SAS code behave differently on those lines.

filename junk "junk.txt";

data temp;
   infile junk ;
   input 
   @1 TYPE $ 2.  
   @4 year 4.
   @9 age1 2.
   @12 age2 2.
   @15 foo 10.2 
   @25 bar 9.2 
   @34 YSD1-YSD3 9.2;   
run;

proc print;

data temp;
   infile junk ;
   input 
   @1 TYPE $ 2.  
   @4 year 4.
   @9 age1 2.
   @12 age2 2.
   @15 foo 10.2 
   @25 bar 9.2 
   @34 YSD1 9.2
   @43 YSD2 9.2
   @52 YSD3 9.2;   
run;

proc print;

I get an erroneous read from the first input, and a correct read from the second input. Trying to figure out what is going on. I actually have a lot more variables than 3, so being able to use the shortcut syntax would be useful to me.

Baltimark
  • 9,052
  • 12
  • 37
  • 35
  • Strange - your first data step (using YSD1-YSD3) works fine for me when I run it against your data. In fact it's your second data step that fails to read the 2nd and 4th observations, and the YSD3 variable. – Seb Charrot May 13 '14 at 15:39
  • Could be a version thing? Anyway. . .I found a colleague who was aware of a snytactic quirk. – Baltimark May 13 '14 at 16:00
  • Out of interest, what was the syntactic quirk? – Seb Charrot May 13 '14 at 16:00
  • I posted it below. Thanks. Still weird that my second one doesn't work for you. That's just being very explicit about it all. – Baltimark May 13 '14 at 16:03

1 Answers1

0

A colleague of mine was familiar with syntax I was not familiar with. The behavior of the following is the same as the behavior of my second technique.

filename junk "junk.txt";

data temp;
   infile junk ;
   input 
   @1 TYPE $ 2.  
   @4 year 4.
   @9 age1 2.
   @12 age2 2.
   @15 foo 10.2 
   @25 bar 9.2 
   @34 (YSD1-YSD3) (9.2);   
run;

proc print;
Baltimark
  • 9,052
  • 12
  • 37
  • 35