06-23-2012 03:20 PM
I have sas code which i run in unix sas by using sas followed by the code name or program name ex: sas test.sas
Now i was asked to create a trigger file to run the sas code on unix environment as it was running manually so far... script .sh .. i am not sure how to create the tirgger file could some help me on this.
The trigger file should have the current timestamp ...
Any help really appriciated!!
06-23-2012 03:24 PM
What do you mean by trigger file? Are you trying to trigger the SAS program when a file exists? Or are you trying to write an output file when the SAS program runs?
06-24-2012 02:23 AM
I have sas code which i run on the unix sas.. that code contains stage tables which needed to feed the data into target tables.
After i run the code i need to collect the statistics i mean the row count of 5 to 6 stage tables and need to send a text file from the with the row count to other server.
The shell script should contain the sql statment with the select count(*) from table2 union all select count(*) from table2...... and it should generate txt file with current time stamp.
Some thing like this: test_current_timestamp.txt (text file)
Pls let me know if you have any queries!!!
06-24-2012 08:33 AM
Is this what you are looking for...
%if &dsid %then
proc append base=want data=&dset force;run;
proc export data=want
06-24-2012 09:29 AM
Why not just modify the original program to write the txt file?
If not then create another program to write the txt file and call it after the first one.
If you really want to avoid creating a second file with the SAS code then look at the -stdio command line option. This will allow you to embed the SAS code into your script.
Are you asking how to find out how many rows are in a table? Are they SAS datasets or database tables?
If they are SAS datasets then you can query DICTIONARY.TABLES. If they are in a database then you might need to use a query to determine the number of rows.
Writing TXT files with SAS is trivial.
file 'test_current_timestamp.txt' ;
put memname nobs;
You can use macro code or data step code and FILE statement options to generate a filename using date time. Or you could have the command script pass in the filename as run time parameter to the program.
06-25-2012 01:01 PM
Thanks Guys for helping me out ... I have invoked bteq script to create a text file .. this solutions provided by all gave me some idea.