BookmarkSubscribeRSS Feed
ravi999985
Calcite | Level 5

I want to know which UNIX command generally uses when we work with SAS. I know some of the commands like CP, NO HUP, but I want to know more which we can use on a daily basis while we work with SAS.

 

 

 

5 REPLIES 5
SASKiwi
PROC Star

There are literally hundreds of Unix commands and they vary in syntax between Unix flavours. If you have a specific requirement then post what it is but you should also just be able to google and find the command you want anyway.

Kurt_Bremser
Super User

Just a few off the top of my head

  • rm - removes a file or directory (directory must be empty)
  • mv - moves (renames) a file or directory
  • cp - copies a file
  • mkdir - creates a directory
  • cd - changes to a directory
  • pwd - shows the current directory
  • find - finds files in a directory tree
  • ls - lists contents of a directory
  • grep - finds text in a file or input stream
  • head - displays top of a file
  • tail - displays end of a file
  • wc - counts words, lines, characters in a file
  • ps - lists current processes
  • date - displays dates (current, or in relation to another date)
  • pg, more, less - displays files one page at a time
  • sort - sorts an input stream
  • cut - extracts columns from an input stream
  • who - shows currently logged in users, but can also (-b) display the last time the system was started

It is very important to understand the piping mechanism, which allows to direct the output of one command to the input of another, e.g.

ls | grep x

displays all directory entries having an x in their name, or

sort < a > b

reads file a, and writes the sorted output to file b.

 

Also learn the syntax of the shell (most often bash), so you can write scripts with conditions and loops.

yabwon
Onyx | Level 15

P.S. One comment. Remember, SAS allows you to write code which is OS independent. Try to use this functionality as often as possible, to make your programs easily portable without need of changing source code.

 

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Sajid01
Meteorite | Level 14

Hello @ravi999985 
It depends on what you are doing.
1.For any one using SAS EG for using SAS on a UNIX server,  a very minimal knowledge of UNIX is sufficient (case sensitivity,  file /path conventions etc, may be ssh/scp).

2.For someone using the Unix shell to write and execute SAS code, write/use shell scripts then a good working knowledge of the shell (BASH/KSH whichever that is  being used) is needed. Focus on developing a knowledge of shell scripting/programming rather than memorizing a few commands.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 813 views
  • 6 likes
  • 5 in conversation