BookmarkSubscribeRSS Feed
excelsas
Calcite | Level 5
There are 45 companies and several employee works in each company.
Each company has its unique code
EX: AA11, AA12..so on
Each emp has a unique id in 16 digit numeric format
In my SAS library I have, 90 datasets (name ends with unique code) 2 dataset for each company containing department and hiring information.
names of the text files are in following format:
Dep_code and Hinfo_code
ex Dept_AA11, Hinfo_AA11 (datasets containing Department and hiring information for each Employee id)

I have third dataset in SAS named Test which contains Employee id and company code.
Now In this dataset, I have to look company code for each Employee id and company code, then need to select the 2 datasets containing Dept and Hiring info from the library ending with the matching code and then create a report containing both the Department and Hiring info.
i.e. from the dataset, check the company code for each employee id , and then select 2 department and hiring datasets for the matching company code and match the employee id, get the Department and hiring info and create the report.

I am new to sas..How should I start.
Any suggesstion is appreciated.

Thanks,
sasuser
2 REPLIES 2
Patrick
Opal | Level 21
Is this real life or study excercise?
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
It's likely that the SAS DATA step process can be used to SET on all company/hiring files if using SAS 9.2, where you can use SET DEPT: (that's a colon character), and also you didn't mention if a SAS variable department (dep_code) is in the DEPT_: / HINFO_: files. If not, you can interrogate the input file using the SET statement parameter INDSNAME= to interrogate what SAS file is inputting the current observation and capture the file-name suffix to assign dep_code.

Either a PROC FORMAT for VALUE look-up or a SAS DATA step MERGE process (with a BY statement and your match-variable list), will work with your SAS programming task to combine the different, but related input files.

And, PROC PRINT or PROC REPORT can be used to generate a suitable report.

You may also find that some tasks can be performed by PROC SQL, if you prefer that language technique.

Suggest you make use of the SAS discussion forum archives and the SAS support http://support.sas.com/ website for SAS-hosted documentation and supplemental technical / conference reference materials.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search arguments, this topic / post:

data step programming intro site:sas.com

data step merge by processing site:sas.com

set statement indsname site:sas.com

proc format table lookup site:sas.com

elearn site:sas.com

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 819 views
  • 0 likes
  • 3 in conversation