Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.
Highlighted
SAS Employee
Posts: 3
CERT94 London 27th Nov - 1st Dec

This is a discussion group for those on the CERT94 London 27th Nov - 1st Dec. Ask any questions you need help with and help out by answering questions you might know the answer to!

SAS Employee
Posts: 3
Re: CERT94 London 27th Nov - 1st Dec
[ Edited ]

*** This is not needed for the Base Certification Exam ***

 

To suppress the word 'Frequency' from appearing every observation when using the FREQ procedure run the following code first...

(to change the template used for proc freq)

 

 

ods path work.templat(update) sashelp.tmplmst(read);

 

 

proc template;

    edit Base.Freq.CrossTabFreqs;

        edit frequency;

            header="";

        end;

    end;

run;

 

 

Or just use proc tabulate! Smiley Very Happy

SAS Employee
Posts: 3
Re: CERT94 London 27th Nov - 1st Dec

This is not on the certification exam - it is the answer to a question asked on the course.

 

********** Create Data **********;

data EmpsAU;

input First $ Gender $ EmpID;

datalines;

 

Togar M 121150

Kylie F 121151

Birin M 121152

;

run;

data PhoneHW;

input EmpID Type $ Phone $15.;

datalines;

 

121150 Home +61(2)5555-1793

121150 Work +61(2)5555-1794

121151 Home +61(2)5555-1849

121151 Work +61(2)5555-1850

121152 Home +61(2)5555-1665

121152 Work +61(2)5555-1666

;

run;

 

 

The following program merges the datasets but only creates one record per EmpID. Work and home phone numbers are concatenated into one string.

 

Multiple records into 1.....

********** One-to-Many Merge **********;

data EmpsAUHW;

merge EmpsAU PhoneHW;

length bigphone $123;

retain bigphone;

by EmpID;

if first.EmpID then bigphone =“ ”;

bigphone=catx(“!! ”,bigphone,phone);

if last.EmpID ;

run;