LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 21 Nov 2002 18:50:33 GMT
Reply-To:     David Wright <David_wright@SPRA.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         David Wright <David_wright@SPRA.COM>
Organization: Your Company
Subject:      Re: Set statement bug?

Well, various members of this newsgroup have once again proved that in spite of all evidence to the contrary, SAS is really a nice neat logical language and can be understood without knowing the source code.

In private corospondence, the solution of my nightmare (set A; setB;) was simple:

Data all; Merge Junk Junk3; Run;

Which puts the datasets 'side by side'. I suppose many of you may be wondering, why in the hell did he use two set statements? My only defense is that because I don't have the facilities to make this up on my own, someone or some book must have told me to do it that way.

My earlier claim that the 'set statement' has a bug assumes that I knew what a set statment was. Just because I have used it a million times reading in datasets apparently is not enough experience to know what is actually going on, unlike say, dropping a hammer a million times and see it falling to the ground is enough to discover the laws of gravity.

To answer Howard_Schreier (below), the answer is that you get one observation as long as both datasets have one observation, no matter how many observations they contain. What lesson I am supposed to draw from this fact escapes me.

Ian Whitlock urges me to try: data all; put "before junk3 " _n_= ; set junk3; put "after junk3 " _n_= ; set junk; run;

Which produces the inexplicable:

before junk3 _N_=1 after junk3 _N_=1 NOTE: There were 1 observations read from the data set WORK.JUNK3. NOTE: There were 0 observations read from the data set WORK.JUNK. NOTE: The data set WORK.ALL has 0 observations and 6 variables.

So, SAS read an observation, then apparently looses it when it sees that the other data set had no observations.

What these experiments show us is that we have a yet a universal theory as to how the set statement works.

Howard_Schreier@ITA.DOC.GOV wrote in <200211211454.gALEsP029264>:

>Consider a more general case, where JUNK and JUNK3 both contain some >observations, but not the same number of observations. >

Back to: Top of message | Previous page | Main SAS-L page