|
On 28 May, 22:13, mlhow...@avalon.net (Mary) wrote:
> Yes, Ya provided a complete solution to my problem that I requested, but =
> really I was working up to a much larger problem. The older I get, the =
> more I try to break things down into accomplishable pieces, then work =
> from there. That way I make progress (and have today). Asking for the =
> whole thing at once was too much to ask, and too much for my mind to =
> take in at once anyway :-). The specs had it the way I'm asking about =
> now, but I wasn't sure I could get to that point this morning, so just =
> tried to take one piece of it, and see if I could get that to work, then =
> build upon it.=20
>
> -Mary
>
>
>
> ----- Original Message -----=20
> From: Howard Schreier <hs AT dc-sug DOT org>=20
> To: SA...@LISTSERV.UGA.EDU=20
> Sent: Wednesday, May 28, 2008 3:57 PM
> Subject: Re: Convert two rows into one row with two variables
>
> I don't quite understand. I thought Ya provided a complete solution. =
> What
> was left to be done?- Hide quoted text -
>
> - Show quoted text -
Hi Mary,
Here's a different approach, using the renaming method data _null_
posted on a seperate post.
data test;
input val statistic $ question1 question2 question3;
cards;
1 N 95 0 2
1 Pct 95.0 5 9
2 N 5 5 4
2 Pct 5.0 1 3
;
run;
proc sort data=test out=_test;
by val statistic;
run;
data _n _pct;
set _test;
by val statistic;
if first.val then output _n;
else output _pct;
drop statistic;
run;
proc sql ;
select name||'='||tranwrd(name,'question','percent') into :rename
separated by ' '
from dictionary.columns
where libname eq 'WORK' and memname = '_pct' and name like
'question_';
quit;
proc datasets;
modify _pct;
rename &rename;
run;
data merged;
merge _n _pct;
by val;
run;
|