Prev: How to call ORACLE function via SAS (via metadata server) not SQL pass-through
Next: PROC GLM: Contrast/Estimate
From: Michael Raithel on 12 Nov 2009 14:07 Dear SAS-L-ers, Craig Johnson asked the following interesting questions: > > I created some code that allows us to use double data entry. After > running > through our first batch of forms I've found two common entry errors. > First, I found users are entering the wrong ID #. That then trickles > down > to the verification process and causes problems when we then can't > match on > ID #. Although I've created code to check for ID's that don't match, > I'd > rather institute some code that minimizes the problem. Is there a > simple > way to have users enter the ID once, then force them enter it again for > verification purposes? Links to examples would be helpful if it is > possible > as I'm new to the whole FSEdit front. > > > > Second, is there a simple way to query the ID against the SAS data file > to > check to make sure it hasn't been entered? I'm finding a chunk of > duplicate > entries I shouldn't have either. Again, links to examples or sample > code > would be helpful. > Craig, some SAS-L sharpie will undoubtedly help you with question #1; but I've got a bead on question #2. Consider creating an Integrity Constraint on ID in your SAS data set. Then, code around it so that attempts to add another observation with that same ID result in an error message that the data entry clerk can act upon. Sadly, I can't help you with the specific SAS/AF - FSP code needed, anymore, but I can point you at the very useful, very helpful SAS Ingtegrity Constraints section in the SAS 9.2 Language Reference: Concepts online documentation: http://support.sas.com/documentation/cdl/en/lrcon/61722/PDF/default/lrcon.pdf An overview starts on page 495; you will want to look at the UNIQUE Integrity Constraint at the top of page 496 and the RESTRICT one a bit further down on that same page. Perhaps these will be just the thing that you need behind-the-scenes to help slay the duplicate entry dragon! Craig, best of luck in all of your SAS endeavors! I hope that this suggestion proves helpful now, and in the future! Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or applicability. People deciding to use information in this posting do so at their own risk. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Michael A. Raithel "The man who wrote the book on performance" E-mail: MichaelRaithel(a)westat.com Author: Tuning SAS Applications in the MVS Environment Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172 Author: The Complete Guide to SAS Indexes http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Rest, with nothing else, results in rust. It corrodes the mechanisms of the brain. The rhubarb that no one picks goes to seed. - Wilder Penfield +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
From: Derek Morgan on 12 Nov 2009 15:36 On Nov 12, 11:45 am, cjohn...(a)GMAIL.COM (Craig Johnson) wrote: > I created some code that allows us to use double data entry. After running > through our first batch of forms I=92ve found two common entry errors. > First, I found users are entering the wrong ID #. That then trickles down > to the verification process and causes problems when we then can=92t match = > on > ID #. Although I=92ve created code to check for ID=92s that don=92t match,= > I=92d > rather institute some code that minimizes the problem. Is there a simple > way to have users enter the ID once, then force them enter it again for > verification purposes? Links to examples would be helpful if it is possibl= > e > as I=92m new to the whole FSEdit front. > > Second, is there a simple way to query the ID against the SAS data file to > check to make sure it hasn=92t been entered? I=92m finding a chunk of dupli= > cate > entries I shouldn=92t have either. Again, links to examples or sample cod= > e > would be helpful. > > Thanks! Craig, I didn't think that anybody was still using FSEDIT :) https://dsgweb.wustl.edu/derek/betterdes.html contains the paper and a sample you can download. https://dsgweb.wustl.edu/derek/dbldata.pdf - Describes a double data entry methodology developed for PROC FSEDIT. Hope these help, Derek
From: Craig Johnson on 12 Nov 2009 17:16 I'm digging through the various responses. Nathaniel Wooding Do you have SAS/AF licensed? =96 Thanks to working at a University yes I do but right now I have 26 different FSEdit screens. =85half of which are modified for second entry that compares it against the first. I=92m trying= to avoid having to create anything else new. Could you use a data step Windows statement? =96 If I was sure what that wa= s maybe! Ya Huang and Michael Raithel I=92m familiar with database construction so I=92m giddy at the idea of lin= king datasets together. I=92ll definitely have to do some reading up on this. = A couple of questions: 1) You can define FK/PK=92s etc after the data set has been created, correct? 2) If entry error occurs it will show up in the log but what about during the data entry on FSEdit? Does an error flash or beep or something? = I need to let my data entry people know that there is an error. Jeff J. Voeller I was seriously pondering doing using a created field before I posted. I was just trying to avoid it if there was a slicker way to do it. Montura Seriously considering using a combo box or pmenu with valid ID=92s, I just have to figure out how make them. I have the SAS Screen Control Language version 6 book but it doesn=92t have much in there. Looking at the net I haven=92t found a simple enough example I can work with understand and port over to the actual apps. TJ I actually had the paper open. J I=92ve referenced it several times. The issue is that when you are just starting out (say you=92ve been using SAS since April) you tend to have issues stripping out code manipulating it and then getting it work. I=92m a pup at this stuff but I=92m getting better. Which brings me to=85.. Derek Morgan Believe it or not we=92ve exchanged emails before about the double data ent= ry. I ended up cobbling something together that works reasonably well. (I=92d = be willing to share the code if anyone is interested.) I=92d love to look ove= r the code on your website however=85=85=85when you click on the sample app ( https://dsgweb.wustl.edu/derek/sugi24.zip) you get =93The requested URL /derek/sugi24.zip was not found on this server.=94 Doh....
From: montura on 13 Nov 2009 07:39 SCL is simple. If you are using v6 the functionality will be limited, very limited. Get a comobox on the screen and point to this code. Modify of course for your application. runInterface: method; dcl num dset xColumn; submit continue sql; create table work.temp as select distinct level1 *<== select your column ; from msis.employee '; * <== select SAS dataset or Oracle, etc. ; quit; endsubmit; * load into the ITEMs of the combox, or other AF widget ;. * this logic loads NUM or CHAR, whatever is present.; * just make sure there is only 1 column in the SQL above ; dset=open('work.temp', 'i'); do while (fetch(dset) =0); do xColumn=1 to attrn(dset, 'NVARS'); if vartype(dset, xColumn) ='C' then setnitemc(items, getvarc(dset, xColumn), varname (dset, xColumn)); else setnitemn(items, getvarn(dset, xColumn), varname (dset, xColumn)); end; end; close (dset); delete ('work.temp'); endmethod;
From: Nathaniel Wooding on 13 Nov 2009 08:01 Craig Here is a code sample that shows a Windows statement. Basically, during the execution of a data step, the Windows statement opens a panel that has user defined fields that the person running the job fills in. In my example, SAS then does something based on the user's reply. It could just as well run another data step or maybe an sql query to test the reply and then give the user a response. Nat * this is a simple SAS window statement demonstration. It assumes that there are two macros, %doit1 and %doit2 . One of these simply issues a blank line but the other runs a SAS job. The window statement asks the user whether to print data that have been added to a data base earlier in the SAS job and all the user has to do is type a single character and hit enter or leave the entry field blank and hit enter; DATA XX ; WINDOW D1 COLOR = blue IROW =1 ICOLUMN = 5 ROWS=15 COLUMNS= 70 #3 @60 YESNO $1. REQUIRED = NO PROTECT=NO DISPLAY = YES PERSIST=YES #3 @2 'TO PRINT THE LIST OF DATA ENTERED, TYPE ANY CHARACTER ' #6 @2 'THEN HIT ENTER ' ; DISPLAY D1 ; IF YESNO GT ' ' THEN SUFFIX=1; ELSE SUFFIX=2; DOIT=COMPRESS('%DOIT'||SUFFIX);* BUILD THE MACRO NAME; CALL SYMPUT('DOIT', DOIT ) ; OUTPUT; STOP; RUN; -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Craig Johnson Sent: Thursday, November 12, 2009 5:16 PM To: SAS-L(a)LISTSERV.UGA.EDU Subject: Re: FSEdit Question I'm digging through the various responses. Nathaniel Wooding Do you have SAS/AF licensed? - Thanks to working at a University yes I do but right now I have 26 different FSEdit screens. ...half of which are modified for second entry that compares it against the first. I'm trying to avoid having to create anything else new. Could you use a data step Windows statement? - If I was sure what that was maybe! Ya Huang and Michael Raithel I'm familiar with database construction so I'm giddy at the idea of linking datasets together. I'll definitely have to do some reading up on this. A couple of questions: 1) You can define FK/PK's etc after the data set has been created, correct? 2) If entry error occurs it will show up in the log but what about during the data entry on FSEdit? Does an error flash or beep or something? I need to let my data entry people know that there is an error. Jeff J. Voeller I was seriously pondering doing using a created field before I posted. I was just trying to avoid it if there was a slicker way to do it. Montura Seriously considering using a combo box or pmenu with valid ID's, I just have to figure out how make them. I have the SAS Screen Control Language version 6 book but it doesn't have much in there. Looking at the net I haven't found a simple enough example I can work with understand and port over to the actual apps. TJ I actually had the paper open. J I've referenced it several times. The issue is that when you are just starting out (say you've been using SAS since April) you tend to have issues stripping out code manipulating it and then getting it work. I'm a pup at this stuff but I'm getting better. Which brings me to..... Derek Morgan Believe it or not we've exchanged emails before about the double data entry. I ended up cobbling something together that works reasonably well. (I'd be willing to share the code if anyone is interested.) I'd love to look over the code on your website however.........when you click on the sample app ( https://dsgweb.wustl.edu/derek/sugi24.zip) you get "The requested URL /derek/sugi24.zip was not found on this server." Doh.... CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: How to call ORACLE function via SAS (via metadata server) not SQL pass-through Next: PROC GLM: Contrast/Estimate |