DATA Step, Macro, Functions and more

Backup the file in sas

Reply
Contributor
Posts: 35

Backup the file in sas

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.

PROC Star
Posts: 7,363

Backup the file in sas

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.

Contributor
Posts: 35

Backup the file in sas

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.

Contributor
Posts: 35

Backup the file in sas

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.

PROC Star
Posts: 7,363

Backup the file in sas

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.

Contributor
Posts: 35

Backup the file in sas

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.

Occasional Contributor ani
Occasional Contributor
Posts: 10

Backup the file in sas

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

Contributor
Posts: 35

Backup the file in sas

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.

Super User
Posts: 9,682

Backup the file in sas

"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

Valued Guide
Posts: 2,175

Backup the file in sas

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

Ask a Question
Discussion stats
  • 9 replies
  • 275 views
  • 0 likes
  • 5 in conversation