BookmarkSubscribeRSS Feed
edopap
Calcite | Level 5

Hello there! 

I can't figure out how to modified the creation date of a file in a sas' directory. I need that in order to "translate" the touch command in Unix lenguage.
Looking around in SASHelp website, i didnt find anything that could work.

Where can I find some tips to solve this problem?

I attached the code itself here below

edopap_0-1701277584457.png

Any advice is appreciated 🙂

 

6 REPLIES 6
ballardw
Super User

One, in the future pleases post code examples or log text by copying the text and pasting into a text box opened on the forum using the </> icon that appears above the main message box.

The result will look like this: (a bit I have in my log at the moment)

157  proc transpose data=s out=s_trans;
158    by id;
159    var price;
160  run;

NOTE: There were 9 observations read from the data set WORK.S.
NOTE: The data set WORK.S_TRANS has 2 observations and 7 variables.
NOTE: PROCEDURE TRANSPOSE used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds

When you provide examples as text if you are close we can make small edits and paste it back as text that you can then copy and paste into your program. If you provide a picture that is not possible. Also, we can't test your code and if the code is more than a few lines almost no one is going to retype it from scratch.

 

Where do you define the macro variables &stag and &out_filename?

If &stag does not point to a path including the root of a drive that would part of the problem.

Which is another point: code should include complete code, macro references without definitions are nearly impossible to debug.

 

Reeza
Super User
First try your code without macro variables. And when using system commands, first ensure the system commands also run.

So what is the issue with the code posted? Does it not work? are there errors in the log?
Reeza
Super User
I would probably use a different variable name than execute as well, that seems like it could cause issues.
SASKiwi
PROC Star

To successfully run your program you will need the SAS option XCMD enabled since you are trying to run an OS command from SAS. You can check the status of this option by running this SAS program:

proc options option = xcmd;
run;
Tom
Super User Tom
Super User

The code you posted is using the TOUCH command.

So what is it that you want translated?

 

State clearly what you want.  You mentioned modified time IN a file.  The code you posted is not putting anything INTO a file.  It is changing the last modified date OF a file. 

Kurt_Bremser
Super User

Run your external command in a pipe:

data _null_;
infile "<external command> 2>&1" pipe;
input;
put _infile_;
run;

so you read all responses in the SAS log; you may have to attach the 2>&1 routing to each single command.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 522 views
  • 2 likes
  • 6 in conversation