Help using Base SAS procedures

What procedure to use to populate data in dataset?

Not applicable
Posts: 1

What procedure to use to populate data in dataset?


I have a SAS shell dataset with a column listing ‘Outcomes’ and a ‘Total # of Outcomes’ column next to it. To produce a daily report, I need to populate the Total column based on another SAS dataset that will be updated daily. How do I go about doing this? What procedure would I use to do this? Proc tabulate?
Frequent Contributor
Posts: 77

Re: What procedure to use to populate data in dataset?


Here is an example that shows how you may "connect" two data sets:

data daily;
input ID $ Total_daily;
01 9283778479
02 39850367
03 3587396
04 359839679
05 369839687
06 386739687

data shell;
input ID $;

proc sort data=daily; by ID;
proc sort data=shell; by ID;

data shell(keep=ID Total);
merge shell daily(keep=ID Total_daily); by ID;
rename Total_daily=Total;

proc print data=shell noobs;
Super Contributor
Super Contributor
Posts: 3,176

Re: What procedure to use to populate data in dataset?

There are several techniques, some of which may be (depending on your input SAS dataset):

1) SAS PROC SQL to read your "another SAS dataset", summarize to daily totals and generate report.
2) SAS DATA step to read your "another SAS dataset", translate those SAS variables/columns to conform with your "SAS shell dataset", summarize to a "daily" totals SAS temporary file, and then generate a report, possibly using either PROC PRINT, PROC REPORT, DATA step?

It's undetermined if you intend to maintain some "running daily totals" from your stated "SAS shell datasets" or if you are in a position to use SAS code to re-read the daily files and create some weekly/month "totals" perspective in report-format.

Questions to ask are how/where is the SAS-generated output/report information to be hosted, in what format, and how will historical report versions to be maintained?
This information is just the start to developing a SAS-based application, given what you have explained thus far - a good start though.

The SAS support website has much information such as technical/conference papers and SAS-hosted documentation for reference and use.

Scott Barry
SBBWorks, Inc.

SAS 9.2 DOC: Reading, Combining, and Modifying SAS Data Sets

SAS 9.2 Documentation - referenced by topic category:
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation