BookmarkSubscribeRSS Feed
sasg
Calcite | Level 5

Hi,

    I have a workflow in sas,it will generate the results and save those results on local machine.

    After I ran next time,I have to backup this file and generate new results with this file.

   Later I have to compare these two results.how can I do this in sas?....somebody help me.

Thanks,

Rk.

9 REPLIES 9
art297
Opal | Level 21

I think that you have to provide more info.  You can make files to be permanent by simply creating them as a two level name, i.e., libname.yourfilename.  You can also rename files and find out if files exist.

Thus, if you don't need the files to be permanent, it may be as simple as creating a file, say, called new.

Then, when you run your code first check to see if 'new' exists and, if it does, rename it to be 'old'.  Then create a new 'new' and compare it with 'old'.

However, I am just guessing as to what you are really trying to do.  More info would be helpful.

sasg
Calcite | Level 5

Hi,

   I want to make files to be permanent by simply creating them as a two level name, i.e., libname.yourfilename.  You can also rename files and find out if files exist.

  I want to proceed with above code......can you send me sample code.

Thanks,

rk.

sasg
Calcite | Level 5

art127,

         sorry,they want all the results(i mean each time i ran) that has to be stored in a dataset with header and footer.i have attached the file with example.

        then i have to give two prompts for dates for comparing results.......in the prompt dropdown,i have to give all dates which are there in the header part of dataset.

       

Header: generated report on 08/15/2011.
Speciality PharmacyMilestone PeriodRaw TotalLess:Missing Product CodeLess:Missing Milestone DateLess:Missing Date and Product
ACS8/1/20101339890203112
ASRX8/1/20103907810190192
Accredo8/1/20101585700440420
Caremark8/1/201022001502299838450
CuraScript8/1/201096000787675458
Diplomat8/1/20101203431315990
Humana8/1/20105094046030
Pharmacare8/1/201082490425
PrecisionRX8/1/2010618051575114
PrescriptionSolutions8/1/201051233143092828
USOncology8/1/20107118057490
Walgreens8/1/20108969402040817370
Footer:  generated report on 08/15/2011.
Header: generated report on 08/16/2011.
Speciality PharmacyMilestone PeriodRaw TotalLess:Missing Product CodeLess:Missing Milestone DateLess:Missing Date and Product
ACS8/1/20101339990303112
ASRX8/1/20103907810190192
Accredo8/1/20101585700440420
Caremark8/1/201022001502299838450
CuraScript8/1/201096000787675458
Diplomat8/1/20101203431315990
Humana8/1/20105094046030
Pharmacare8/1/201082490425
PrecisionRX8/1/2010618051575114
PrescriptionSolutions8/1/201051233143092828
USOncology8/1/20107118057490
Walgreens8/1/20108969402040817370
Footer:  generated report on 08/16/2011.

Thanks,

Bhavani.

art297
Opal | Level 21

Sounds like the filenames are not the relevant issue but, more so, what the resulting file has to look like.  Without seeing the files one can only guess, but my guess is you will need proc report or proc tabulate, bringing in the two different files, summarizing them, and printing the results with headers and footers that incorporate the infiles.

As neither are my specialty, I'll leave suggesting the necessary code to others to help you with.

sasg
Calcite | Level 5

Hi,

     I have one program which will generate error list for specified period.

     Each time i ran that program results should be stored in the dataset with header and footnotes(is header and footnote  possible for dataset?)

dataset:

Header: generated report on 08/15/2011.
Speciality PharmacyMilestone PeriodRaw TotalLess:Missing Product CodeLess:Missing Milestone DateLess:Missing Date and Product
ACS8/1/20101339890203112
ASRX8/1/20103907810190192
Accredo8/1/20101585700440420
Caremark8/1/201022001502299838450
CuraScript8/1/201096000787675458
Diplomat8/1/20101203431315990
Humana8/1/20105094046030
Pharmacare8/1/201082490425
PrecisionRX8/1/2010618051575114
PrescriptionSolutions8/1/201051233143092828
USOncology8/1/20107118057490
Walgreens8/1/20108969402040817370
Footer:  generated report on 08/15/2011.
Header: generated report on 08/16/2011.
Speciality PharmacyMilestone PeriodRaw TotalLess:Missing Product CodeLess:Missing Milestone DateLess:Missing Date and Product
ACS8/1/20101339990303112
ASRX8/1/20103907810190192
Accredo8/1/20101585700440420
Caremark8/1/201022001502299838450
CuraScript8/1/201096000787675458
Diplomat8/1/20101203431315990
Humana8/1/20105094046030
Pharmacare8/1/201082490425
PrecisionRX8/1/2010618051575114
PrescriptionSolutions8/1/201051233143092828
USOncology8/1/20107118057490
Walgreens8/1/20108969402040817370
Footer:  generated report on 08/16/2011.

Then based on dates on header we have to create two promts with all the dates.....what ever dates they selected we have to generate the results.

ex: date1...08/15/2011

      date2...08/16/2011

outputfile1:

Speciality PharmacyMilestone PeriodRaw TotalLess:Missing Product CodeLess:Missing Milestone DateLess:Missing Date and Product
ACS8/1/20101339890203112
ASRX8/1/20103907810190192
Accredo8/1/20101585700440420
Caremark8/1/201022001502299838450
CuraScript8/1/201096000787675458
Diplomat8/1/20101203431315990
Humana8/1/20105094046030
Pharmacare8/1/201082490425
PrecisionRX8/1/2010618051575114
PrescriptionSolutions8/1/201051233143092828
USOncology8/1/20107118057490
Walgreens8/1/2010896940204081737

outputfile2:

Speciality PharmacyMilestone PeriodRaw TotalLess:Missing Product CodeLess:Missing Milestone DateLess:Missing Date and Product
ACS8/1/20101339990303112
ASRX8/1/20103907810190192
Accredo8/1/20101585700440420
Caremark8/1/201022001502299838450
CuraScript8/1/201096000787675458
Diplomat8/1/20101203431315990
Humana8/1/20105094046030
Pharmacare8/1/201082490425
PrecisionRX8/1/2010618051575114
PrescriptionSolutions8/1/201051233143092828
USOncology8/1/20107118057490
Walgreens8/1/2010896940204081737

can someone help me on this issue.

Thanks,

rk.

ani
Calcite | Level 5 ani
Calcite | Level 5

Hi Rk,

As per my understanding , when you save the those result in your local system just add the &systime (automatic macro var) in the outfile name. So whenever you run those code it will gennerate different outfile .

And for compare import the previous outfile and using PROC COMPARE compare it with the present .

Hope it'll help.. Smiley Happy

sasg
Calcite | Level 5

ani,

    i'm not comparing files in sas........i just have to send two files to them......previous ran results and current.

    With date stamp with file they can't able to use that file in spot-fire it seems.

Thanks,

Bhavani.

Ksharp
Super User

"results should be stored in the dataset with header and footnotes(is header and footnote  possible for dataset?"

The dataset can not hold title or footnote if you want to keep different variables too.

But you can use data step to put the result into a txt or csv file.

Or use ODS to product different type file .

Ksharp

Peter_C
Rhodochrosite | Level 12

sasG

are you seeking a way to compare two reports (not sas data sets)?

If so, how do you want to show the differences?

It may be possible for SAS to create the report of differences in a much reduced style, if these changes happens slowly.

Perhaps it might be better (if most rows change on each report run) to add a "change since last report" column.

How is the current report produced? Is it Web Report Studio, or on the SAS Portal?

hth

peterC

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1220 views
  • 0 likes
  • 5 in conversation