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 (October 2003, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 9 Oct 2003 10:28:40 -0400
Reply-To:     Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:      Re: Help with SAS program

Put aside the macro for now.

It seems that what you want is a DATA step along these lines:

data errortable(keep = [list of important fields] errormessage); set edt_final; if index(rslt_si, '+') > 0 then do; errormessage = [some string formula]; output; end; run;

The KEEP dataset option does the variable subsetting and the OUTPUT statement within the IF block does the observation subsetting.

If you have a macro which will generate the assignment statement for the errormessage variable, fine. Otherwise hard code it. You should understand that you are not calling the macro conditionally. Rather, you are using the macro to build a statement which will be executed conditionally.

On Thu, 9 Oct 2003 01:01:05 -0700, chuaby <chuaby@HOTMAIL.COM> wrote:

>Hi > >I am not used to SAS program structure and i would like to seek some >help please. > >I am trying to do this : > >Go row by row and if field RSLT_SI contains '+' sign, >output the row (with only some important fields + error message to >error table. > >I have a macro : >%ADD_ERR_MSG(TRL_NAME, PAT_INIT, PAT_DOB, PAT_NO, V_NAME, T_NAME, '+ >sign exists.'); > >This is working alright. > >But may i know how do i combine with eg data step where it will go row >by row and call this macro %ADD_ERR_MSG if the field RSLT_SI contains >'+' sign ? >I have problem passing parameters into the macro. I mean, it is easy >to achieve this using 3rd gen language like C/basic, but i have >problem doing it using SAS. > >I need some help please. Thank you. > >ideally, i try to achieve : > >data a; >SET EDT_FINAL; >if index(RSLT_SI, '%+%') > 0 then >%ADD_ERR_MSG(TRL_NAME, PAT_INIT, PAT_DOB, PAT_NO, V_NAME, T_NAME, '+ >sign exists.'); >run; > >Thank you in advance for any advice >Boon Yiang


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