12-11-2012 01:35 PM
12-11-2012 04:22 PM
From my trusty SAS 1979 manual (I believe the last time that all of SAS fit into one book), CARDS and CARDS4 statements only, no DATALINES.
I remember reading once that if I wanted to use an infile statement to provide options (I frequently use dlm='09'x for tab delimited), I had to use datalines NOT cards. But I just ran a test, and cards works on an infile statement also, so I guess this assumption is out of date (like I'm beginning to feel!).
12-11-2012 05:14 PM
12-11-2012 05:58 PM
The following 2007 SGF paper, by last year's SGF chair (Andy Kuligowski) http://www2.sas.com/proceedings/forum2007/220-2007.pdf, describes a case where one worked while the other didn't:
However, this is one case where SAS decided not to insure that code working on one version would continue to work on the next version. With 9.3 both of the above will result in an error.
12-12-2012 07:09 AM
I guess my verion of 9.3 is a little different from your. I get the Kuligowski result. It is interesting to see what SAS says the name of the file is.
29 data _null_;
30 set sashelp.class;
31 file datalines filename=fname;
32 put fname=;
33 put name;
NOTE: There were 1 observations read from the data set SASHELP.CLASS.
12-12-2012 09:37 AM
DN: Andy's example didn't include either a cards or datalines statement at the end. However, with your code, I too get the same results as you. And, indeed, the filename assigned makes me feel young again!