BookmarkSubscribeRSS Feed
GN0001
Barite | Level 11
Hello team,
I need to run a sas program that has ksh extension instead of sas. What difference does this extension do?
Best regards,
Blue blue
Blue Blue
8 REPLIES 8
Patrick
Opal | Level 21

.ksh is the extension for Korn Shell scripts. If the file is a SAS program then ideally change the suffix to .sas as .ksh is just wrong. 

....but shouldn't be an issue to run a SAS program stored in a file with the wrong suffix. 

 

HOW do you plan to run this program? An %include statement to it, in batch via your own script, or in batch using a scheduler ....(which could cause some issues if using a SAS OEM version of lsf which doesn't allow for scheduling files other than .sas). 

GN0001
Barite | Level 11

Hello,

Thanks for the response. I have several csv files that I need to combine them and put in a folder. I wonder if KSH extension can do that.

in one of them I have:

./01_split.ksh

./02_split.ksh

./03_add_somthing.ksh

./04_abc_combine.ksh

./04_def_combine.ksh

Regards,

blue blue

Blue Blue
Patrick
Opal | Level 21

@GN0001 wrote:

Hello,

Thanks for the response. I have several csv files that I need to combine them and put in a folder. I wonder if KSH extension can do that.

in one of them I have:

./01_split.ksh

./02_split.ksh

./03_add_somthing.ksh

./04_abc_combine.ksh

./04_def_combine.ksh

Regards,

blue blue


The name and extension of the files is less important than it's content. You need to share what's IN these files for us to give you more guidance. 

And yes, there are Unix/Korn Shell commands that allow to manipulate files.

Sajid01
Meteorite | Level 14

I agree with what @Patrick has said.
The very fact that  Korn shell scripts are in use indicates that they have been around for quite  some time. Seniors who have been around in the organization should be able to assist.,
You have said that you want combine csv file and move them to a folder. Going by your posts in this thread, I suggest consider using SAS.

Tom
Super User Tom
Super User

KSH extension is sometimes used to indicate that the file contains korn shell commands.

 

But both SAS programs and Korn Shell programs are just text files.  So look at the file and see whether it has SAS code or Unix commands. (or perhaps it has both).

 

If you don't know how to open the file with a text editor you can just have SAS read the file and dump the contents to the SAS log.

data _null_;
  infile 'myfile.ksh' ;
  input;
  list;
run;
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @GN0001 

 

Did you look at the file content? - It might be a korn script that executes a SAS program. If this is the case, the script contains a command to start SAS with the program path/name as one of the arguments. This gives you 3 possible ways of executing the SAS program:

 

  1. Copy the program path/name and run it in a SAS session with %include.
  2. Run the script from a command line, if you have direct access to the server.
  3. Run the script in a SAS session by using the X command, if you have the XCMD option set.

 

Sajid01
Meteorite | Level 14

In many organizations with SAS installed in UNIX/Linux environment , Korn shell scripts are used to call SAS programs.
These scripts may are typically executed by some sort of scheduler. It is quite possible that this may be the case.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 8 replies
  • 1477 views
  • 7 likes
  • 6 in conversation