Date: Mon, 9 Jul 2012 13:34:30 -0400
Reply-To: "Pirritano, Matthew J" <PirritanoM@AETNA.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Pirritano, Matthew J" <PirritanoM@AETNA.COM>
Subject: Re: repeat a command for group of adjacent variables
In-Reply-To: <F3A9A867E890544380F9520380F3454F2D34FD3E20@MIDPMSGCMS03.aeth.aetna.com>
Content-Type: text/plain; charset="us-ascii"
Okay, I understand now that 'do over' is deprecated. I see that I can use the logic Ronald provided. What I was really missing was the double hyphen.
Thanks to all!
Matt
Matthew Pirritano, Ph.D.
Project / Team Lead
CHOC Health Alliance
(Managed by Schaller Anderson, an Aetna Company)
1120 La Veta Avenue, Suite 450
Orange, CA 92688-4224
Phone: 714.565.4348
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Pirritano, Matthew J
Sent: Monday, July 09, 2012 7:53 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: repeat a command for group of adjacent variables
Awesome, Fried Egg!
The double hyphen plus 'do over'. I didn't find that in any of the resource I looked at.
Thanks!
Matt
Matthew Pirritano, Ph.D.
Project / Team Lead
CHOC Health Alliance
(Managed by Schaller Anderson, an Aetna Company)
1120 La Veta Avenue, Suite 450
Orange, CA 92688-4224
Phone: 714.565.4348
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Fried Egg
Sent: Friday, July 06, 2012 5:02 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: repeat a command for group of adjacent variables
data matt.freq; set matt.freq;
array num num_AAB -- num_WCC_All_3_to_11;
do over num;
if missing(num) then num = 0;
end;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Pirritano, Matthew J
Sent: Friday, July 06, 2012 5:56 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: repeat a command for group of adjacent variables
Sassers,
I'm a long time spss user. Trying to wrap my head around sas.
This is something I would have done with a do-repeat loop in spss.
Repeat some simple syntax like:
If missing(x) = 1 then x = 0;
I want to run this on 57 adjacent variables.
This is what I've tried with no success:
data matt.freq; set matt.freq;
array num {57} num_AAB - num_WCC_All_3_to_11;
do i = 1 to 57;
if missing(num) = 1 then num = 0;
end;
run;
Where num_AAB - num_WCC_All_3_to_11 represents the range of 57 variables I want to repeat this command on.
Any aid is much appreciated.
Thanks
Matt
Matthew Pirritano, Ph.D.
Project / Team Lead
CHOC Health Alliance
(Managed by Schaller Anderson, an Aetna Company)
1120 La Veta Avenue, Suite 450
Orange, CA 92688-4224
Phone: 714.565.4348
This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately.
Thank you. Aetna