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 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 23 Oct 2007 13:28:12 -0500
Reply-To:     Mary <mlhoward@avalon.net>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: Newbie wants to program
Comments: To: Pat <PLarkin2@GMAIL.COM>
Content-Type: text/plain; charset="iso-8859-1"

Correction- I needed to read the whole record before doing the replace- otherwise it updates those other variable as well as w.

-Mary

data set1;

informat x 4. y 4. z 4. w 4.;

input x y z;

cards;

1 100 200

2 101 201

3 102 202

4 103 203

5 104 204

6 105 205

;

proc sql;

select count(*)

into :set1n

from set1;

run;

%Put >>>&set1n<<< ;

proc iml symsize=20000 worksize=20000;

start mod1(set1n);

edit set1;

do j=1 to set1n-3;

i=j+3;

read point i var 'x' into x;

read point i var 'y' into y;

read point i var 'z' into z;

if x ^= -99 then

w=(x+y)/z;

else

w= -99;

read point j var 'x' into x;

read point j var 'y' into y;

read point z var 'z' into z;

replace;

end;

finish;

run mod1(&set1n);

quit;

run;

proc print data=set1;

run;

----- Original Message ----- From: Pat To: SAS-L@LISTSERV.UGA.EDU Sent: Tuesday, October 23, 2007 12:29 PM Subject: Newbie wants to program

I work with financial data at a university using SAS 9.1. In the past, I've manipulated my data using an assembly language program that I'm too embarrassed to name (but it starts with an F and ends with a tran) and then entered it into SAS to do regressions and other statistical procs. I've heard that this is a waste of time and that I can just do all of the manipulations in SAS. I am having trouble figuring out how to do that. I know that SAS has an array statement, but I don't think that I really want to make an entire row into an array. Let me try to explain what I'd like to do. It's pretty simple:

x1 y1 z1 x2 y2 z2 . . . . . . xn yn zn

I would like to be able to create a variable, call it w, and make it an array with dimensions n-3 rows by 1 column. Then, do something like this, but using SAS code:

do i=1,n-3 if x(i+3) not equal to -99 then w(i) = x(i+3) + y(i+3) / z(i+3) else w(i) = -99 end if end do

Thanks for your attention


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