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 (February 1997, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 8 Feb 1997 16:23:49 GMT
Reply-To:     lpogoda@AOL.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         lpogoda@AOL.COM
Organization: AOL
Subject:      Re: SCL Program problem- very simple and very frustrating.

In article <>, (Mark Lewis) writes:

>I'm fairly new to SAS, and have spent a while trying to get an SCL >program to work. I've distilled the problem down to the simple >program below. Pressing "Button" is fine but "Button2" causes a halt, >which must be something to do with the WHERE clause. > >The program has a FRAME with a text entry box for "condset" as well as >some other variables to check the CALL SET works. > > >Init: > condset=.; > condreq=1.; > filereq=.; > rc=.; >Return; > >Button: > filereq=OPEN('inputs.condset(WHERE=(condset EQ 2.))','I'); > CALL SET(filereq); > rc=FETCH(filereq); > rc=CLOSE(filereq); >Return; > >Button2: > filereq=OPEN('inputs.condset(WHERE=(condset EQ condreq))','I'); > CALL SET(filereq); > rc=FETCH(filereq); > rc=CLOSE(filereq); >Return; > > >If anybody wants to shed light on the pathetically simple error, I >would be most happy. > >

The immediate problem in button2 seems to be the WHERE condition. If variable CONDREQ is not on the data set, the open request will fail. You need to construct a string that will resolve to "condset eq 1" (if condset is numeric) or "condset eq '1'" (if condset is character. If numeric, what you need is something like WHERE = ('CONDSET EQ ' || PUT(CONDREQ, 1.)) If character, try WHERE =(CONDSET EQ ' || QUOTE(PUT(CONDREQ, 1.)))

Now, a few words about technique. Every time the user pushes either button, you're opening the data set, mapping data set variables to scl variables, and closing the data set. That can come to a considerable amount of overhead. I'd suggest moving the OPEN an SET statements to the INIT section, the CLOSE statement to the TERM section (or whatever the terminating section of your program is) and using a WHERE clause in the BUTTONx sections. Additionally, I'd initialize numeric variables with _BLANK_ instead of dot(.)(this affects the appearance on the screen). Where variable names map to screen names, there often, even usually, is no need to initialize values in the program at all. Your program becomes:

Init: filereq=OPEN('inputs.condset', 'i'); call set(filereq); condreq=1; Return;

Button: rc = WHERE(filereq, 'condset EQ 2'); rc = FETCH(filereq); rc = where(filereq, 'clear'); Return;

Button2: rc = where(filereq, 'conset eq ' || put(condreq, 1.)); rc = FETCH(filereq); rc = where(filereq, 'clear'); Return;

term: rc = close(filereq); return;

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