SAS Log

Reply
Super Contributor
Posts: 371

SAS Log

Hello,

I have a file (toto.txt or toto .sas7bdat)  and I know the date of ceation of toto.

I want to get the log associated with the creation of  the file toto ?

Thank you

Super User
Posts: 5,257

Re: SAS Log

Log files are not saved automatically. You need a routine. Hoe was it created?

Data never sleeps
Super Contributor
Posts: 371

Re: SAS Log

My log files (log1.log, ........, logn.log) are created and saved in a folder : fold

I have a data :its name is  filJ and I know the date of creation .

I want to get sas log that we can see the creation of data : filJ

Thank you

Super User
Super User
Posts: 6,502

Re: SAS Log

Use GREP to find out which logs have a note about writing that data set. Then look at the dates on the logs.

grep -n 'The data set .*\.TOTO has' *.log

Super Contributor
Posts: 371

Re: SAS Log

Thank you that's right

but the problem is that , if i use "grep -n 'The data set .*\.TOTO has' *.log"  I can have so many log files contains : 'The data set .*\.TOTO has'

but the difference beteween them : the date of creation .

in  folder, I will have

data name  date of creation

Folder 1

d1    11DEC2011:23:59:13

d2    21JAN2008:10:19:59

.......................................



Folder n

dn1    11OCT2011:13:59:13

dn2    21MAR2008:11:19:59

.......................................


My idea is to keep the file name (dnj, j=1....n) and the date of the creation and check in the files log, if I can have the file (ex: data=dn1 and date of creation=

11OCT2011:13:59:13)

An other means, can we have usually in the file log " the name of the file associated with the date of creation" ? or an other information indicates that the history of the creation of file dnj is in log file logj.log ?


like this : ?

logn.log :

........................................

....................................


The data set ....TOTO has......  

11OCT2011:13:59:13

....................................

...................................


Thank you



Super User
Super User
Posts: 6,502

Re: SAS Log

Read the names and last mod dates into a file. There are many postings on this site for how to do that.  Or you might be able to just read the first line of each log file and find the date it started on the top.

Use the grep to find the list of files that have an indication of writing to the file of interest. Trouble with this is that unless you use consistent LIBREFs across the programs (or there is only one TOTO dataset on your system) you might need to do more searching to tell if the note is referring to the version of TOTO that you are looking for.

Then merge the two lists and take the one with the latest date (or latest date that is reasonable given the modified date on the TOTO dataset).

Super Contributor
Posts: 371

Re: SAS Log

Thank you for your message.

If I understand well, I can use  "the time of  log  starting on the top." but the  time of log starting can be different from the time of creation of TOTO

my log can started at 11OCT2011:13:59:13 and create the toto data at 11OCT2011:14:07:13.

I will be intersted to know, if in all log files, when sas write in log : The data set  TOTO has ... it will write after the date of creation :

11OCT2011:14:07:13 ?

Note : The data set  TOTO has ...

Created 11OCT2011:14:07:13 ?



Valued Guide
Posts: 3,208

Re: SAS Log

NOTE: The file library TEST is:

       Directory=/folders/myfolders/test,

       Owner Name=root,Group Name=root,

       Access Permission=drwxrwxrwx,

       Last Modified=19 juli 2015 19:45:51 uur

Version and NLS differences aside that Created and Last modified

---->-- ja karman --<-----
Super Contributor
Posts: 371

Re: SAS Log

Thank you jaap.

Please could you explain "Version and NLS differences aside that Created and Last modified" ?

Valued Guide
Posts: 3,208

Re: SAS Log

"Log files are not saved automatically" Correct, to be more precise.

- EG will get the log information and only when saved it will be stored inside that EGP project otherwhise it will get lost.

- The classic DM usage will redirect the sas-log to your screen and it will be lost after closing when not explicitly saved

- the batch processing will save a log (and list/print) at locations defined by that batch script.

There is whole logging frame-work that is part of the installation/configuration, ask your IT staff. SAS(R) 9.4 Interface to Application Response Measurement (ARM): Reference. This is also the basics used for APM (audit performance measurement) that has been deprecreated with the Eventmanager and all using this ARM source. Your question seems to be on some audit question. 

---->-- ja karman --<-----
Super Contributor
Posts: 371

Re: SAS Log

Thank you Jaap

Valued Guide
Posts: 3,208

Re: SAS Log

The grep command is an Unix command I suppose your are running Eguide wit a server-based Unix version.

The creation date (and modification) are attributes of a sas-datasets (proc contents). When you have a place where are log-files are stored you could make a directory listing having the date (closing date/time of the sas process. By that limiting that in a window. If you know the owner and that one is unique not shared IT will have another subsetting.  Still a lot of work wher APM / eventmanager are meant to do that.

If you are on a project where:

a/  it is important to have those  answers who has done what and when.

b/ The code is managed by release management  tested and validated before real usage.

You could implement your own logging into that. This user has:  done...  program .... action .... at ....     
By that approach it will become part of your applications and adding those controls to it.

---->-- ja karman --<-----
Valued Guide
Posts: 3,208

Re: SAS Log

Your log example is dared as of Oct 2011. That is 4 years old and their should be new versions in place with pssuble slight differences. With that old dates it more research on an old case.

Your dates are English formatted that one of mine in my own national language.

I replaced a dataset that already did exist. The note is noting that. Would I have deleted it first it must be a created note. That surprises me as the datastep always create all data as new. Using a modify statement would cause an update in place.

---->-- ja karman --<-----
Super Contributor
Posts: 371

Re: SAS Log

@jaap: you're right. I should have  to say " the time of last modification" and not" the time of creation"

But in my case there is no modification, there is only a creation, that's why I have used the word: creation.

To resume for the others: I have a data file. I know the name of my data file(toto ) and the date of creation of data toto.

I want to keep the log file who contains the history of the creation of my data file : toto ( all my sas log files are saved in folder : FL)

In folde : FL2011/ toto, time of creation =11OCT2011:14:07:13


In folde : FL2014/ toto, time of creation =11OCT2014:11:07:13


........................................;;;;;;;;

Ask a Question
Discussion stats
  • 13 replies
  • 349 views
  • 0 likes
  • 4 in conversation