Date: Sat, 24 Sep 2005 04:20:04 -0700
Reply-To: pa pa <ctll04@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: pa pa <ctll04@YAHOO.COM>
Subject: Converting pseudo code into macro
Content-Type: text/plain; charset=iso-8859-1
I am new to macros. I can write some SAS normal code but not macros. They seem an advanced topic. I am learning macros and would like to write something as the following pseudo code:
// This function compare all the values/rows in the first column of a dataset with a number.
// If they are the same, the row will be encoded to be 1, otherwise, 0.
function EncodeTheClass(dataset, number)
for each row of the dataset
If( dataset.FirstColumn = number)
that row = 1
that row = 0
Could someone please help me to turn this into a macro so that I can reuse it many times? Also how to call it in a sas code?
And finally, how can I know PROGRAMATICALLY how many 1s in the resultant/encoded column. I know that we can use PROC FREQ, but that is me, human can read the output. If I then want to input that value into another macro, I dont want to MANUALLY input. In oanother word, how a macro/sas code can actually get the frequency of a colum, i.e. I am looking for something like: "Frequency(column.values['1'])" -> get frequency of a specific value in a column.
Have a nice weekend
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around