DATA Step, Macro, Functions and more

Datalines VS Cards.

Reply
Super Contributor
Posts: 276

Datalines VS Cards.

Hi All..

Is there any any difference between Card and Dataline  Statements ????

Please Clarify me...

Thanks & Regards..

Sanjeev.K

Respected Advisor
Posts: 3,799

Re: Datalines VS Cards.

Posted in reply to kuridisanjeev

Only the spelling.

Super Contributor
Posts: 276

Re: Datalines VS Cards.

Posted in reply to data_null__

Thanks for your detailed explanation..:-)

Super User
Posts: 11,343

Re: Datalines VS Cards.

Posted in reply to kuridisanjeev

I wouldn't put a big bet on it but I believe in ancient days, SAS 5 perhaps, CARDS meant 80 column input to simulate punch cards, hence the name.

Super Contributor
Posts: 276

Re: Datalines VS Cards.

Hi..

Did't get you completely...

Regards..

Sanjeev.K

PROC Star
Posts: 7,474

Re: Datalines VS Cards.

: I think it started WAY earlier than that!  I seem to recall that being the same syntax that was used in the Statistical Analysis System out of North Carolina State University.

But we've progressed!  Now we get to type 9 characters, rather than 5, to specify "cards".

PROC Star
Posts: 1,167

Re: Datalines VS Cards.

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!).

Tom

PROC Star
Posts: 7,474

Re: Datalines VS Cards.

: Do you want to feel young?  My first computer program looked like the one in this picture:

http://www.google.ca/imgres?imgurl=http://lewisshepherd.files.wordpress.com/2010/08/ibm-402-plugboar...

PROC Star
Posts: 1,167

Re: Datalines VS Cards.

I doff my chapeau to you sir! We studied them in school, but I will bow down and admit I've never used one, nor have I ever seen one.

Extremely cool!

  Tom

PROC Star
Posts: 7,474

Re: Datalines VS Cards.

: Somehow I think the IBM 402 accounting boards must be where the term spaghetti code originated.

Occasional Contributor
Posts: 15

Re: Datalines VS Cards.

Actually datalines is an alias of cards and vice-versa as per sas documentation.....

Frequent Learner
Posts: 1

Re: Datalines VS Cards.

Tom,

 

>>...SAS 1979 manual...all of SAS fit into one book...

 

I had Gayle Sayers autograph mine as I only had that at hand when I was working at Hitachi in Brisbane, Ca. He asked me what the book was and after I told him he just smiled and said, "Okay".

Frequent Contributor
Posts: 86

Re: Datalines VS Cards.

Posted in reply to data_null__

Your sense of humour is great. Smiley Happy

PROC Star
Posts: 7,474

Re: Datalines VS Cards.

Posted in reply to kuridisanjeev

: Apparently, if you are using an older version of SAS, there may be one difference.

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:

data _null_;

  set sashelp.class;

  file cards;

  put name;

run;

data _null_;

  set sashelp.class;

  file datalines;

  put name;

run;

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.

Respected Advisor
Posts: 3,799

Re: Datalines VS Cards.

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;
34            stop;
35            datalines;

fname=CARDS
Alfred
NOTE: There were
1 observations read from the data set SASHELP.CLASS.

Ask a Question
Discussion stats
  • 21 replies
  • 12305 views
  • 10 likes
  • 9 in conversation