Recently in the SAS Community Library: SAS' @BethEbersole reveals 4 steps to stop money laundering, solve law-enforcement cases, find missing children and more with SAS Visual Investigator.
Two Identical Table one at work lib and another in sql sever - One getting generated thru SAS process @ Work Library and based on that I would like to simply update the SQL Server table. What is the best way to do so ?
I have 100+ columns in Work lib table and same in SQL server table.
I have library with SQL Server.
... View more
Hello SAS community,
I have variables with the following
original format
proc format;
value s 0 ="Never/almost Never" 1 ="Once in a while" 2 ="Some days" 3 ="Most days" 4 ="Everyday" 5 ="Many times/day" . ="Unknown";
I'm now being asked to do reverse formatting for a bunch of variables
/*1 = many times a day, 2 = every day, 3 = most days, 4 = some days, 5 = once in a while, 6 = never*/
data have;
input id strngth peace beauty prscnc union love;
cards;
1 0 1 2 3 4 5
2 4 0 0 1 3 4
3 4 2 3 2 5 0
4 2 4 4 0 2 3
5 0 3 5 0 0 1
6 3 5 1 4 3 4
7 5 2 3 2 1 0
8 3 2 2 5 2 1
9 5 1 3 2 1 0
10 4 0 0 1 3 4
11 0 2 3 2 5 0
12 2 4 4 0 2 3
;
run;
data have2;
set have;
format strngth peace beauty prscnc union love s.;
run;
proc freq data=have2;
title 'orig';
tables strngth / list missing;
run;
proc format;
value sr
6 ="Never/almost Never"
5 ="Once in a while"
4 ="Some days"
3 ="Most days"
2 ="Everyday"
1 ="Many times/day"
. ="Unknown";
run;
data want;
set have2;
if strngth = 5 then strngth2 = 1; else
if strngth = 4 then strngth2 = 2; else
if strngth = 3 then strngth2 = 3; else
if strngth = 2 then strngth2 = 4; else
if strngth = 1 then strngth2 = 5; else
if strngth = 0 then strngth2 = 6; else
strngth2 = .;
format strngth2 sr.;
run;
but I'm getting the following for recoded - unable to copy in both tables:
original
strngth
Frequency
Percent
Cumulative Frequency
Cumulative Percent
Never/almost Never
3
25.00
3
25.00
Some days
2
16.67
5
41.67
Most days
2
16.67
7
58.33
Everyday
3
25.00
10
83.33
Many times/day
2
16.67
12
100.00
recoded
strngth2
Frequency
Percent
Cumulative Frequency
Cumulative Percent
Many times/day
2
16.67
2
16.67
Everyday
3
25.00
5
41.67
Most days
2
16.67
7
58.33
Some days
2
16.67
9
75.00
Never/almost Never
3
25.00
12
100.00
I would like to be able to-
correctly apply the correct format to the recoded variable - I also need to keep the original format
do this efficiently for a bunch of variables
Thanks,
Maggie
... View more
Hi,
From this table:
DATA HAVE;
INPUT CODE TYPE$ CATEGORY$;
CARDS;
15 A Y6D
15 B K45
08 A LS7
08 B G27
63 A A09
63 A Q98
63 B Z98
05 A P09
10 A W87
;
RUN;
I would like to obtain the following result:
Thanks
... View more
Greetings, I'm seeking a mentor proficient in SAS who can guide me through the intricacies of the software over the next 3-5 months. I'm enthusiastic about learning, a quick learner, and prefer remote instruction.
... View more
Plan to Attend WUSS 2024 in Sacramento
Mark your calendar for the Western Users of SAS Software 2024 annual conference! This year’s event will be September 4-6, 2024, at the Hyatt Regency Sacramento in Sacramento, California.
Registration and hotel reservations are now open!
We are once again offering a broad variety of classes.
... View more