BookmarkSubscribeRSS Feed
jimmansfield
Calcite | Level 5

What function in enterprise guide can perform the following?   or should I write code?

 

removing spaces (zip code exampls from UK where we need exact to match; or fuzzy match contains instead) which is best?

Postcode
AL7 1JR
AL7 4HQ
AL7 4HQ
AL7 4HQ
B13 8JL
B15 2GW
B15 2GW

 

 

populating 0 where blank exists;

KOLcity_number KOLcity_networkscore
. .
. .
. .
. .
. .
. .
. .
. .
. .
. .
1 1
1 1
. .
1 1
1 1
1 1
1 1
1 1
1 1
. .
1 1

 

 

 

Populating means or median where blanks exist

 

SurgAdmissions
0
0
0
0
35439
0
0
0
0
54372
0
54372
0
0
0
0
76629
0
30692
49311
0
23813
63084
0
2360

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

I don't know much about EG point and click tools. Here is simple code to do what you want though

 

/* 1 */
data have;
input Postcode $ 1-7;
datalines;
AL7 1JR
AL7 4HQ
AL7 4HQ
AL7 4HQ
B13 8JL
B15 2GW
B15 2GW
;

data want;
    set have;
    NewPostcode=compress(Postcode);
run;

/* 2 */
data have;
input ID$ var1 var2 var3;
datalines;
1 . 3 4 
2 2 0 .
3 . . 3
4 . 8 .
5 5 . .
;

/* Replace missing with zero */
proc stdize data=have out=wantZero reponly missing=0;
run;

/* Replace missing with mean */
proc stdize data=have out=wantMean reponly missing=mean;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 576 views
  • 0 likes
  • 2 in conversation