BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Go
Quartz | Level 8 Go
Quartz | Level 8

Hi All,

 

When I create (touch) files in UNIX terminal, the default group is xxx and to change it yyy, i can use newgrp command and I will be fine,

 

But When I create files(for example a test data set) through Enterprise Guide, the default group goes to xxx and I want it to be yyy, how can i achive this ? thanks

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

Jan's suggestion, above is a good one, and probably the best if you don't mind changing the default group for the entire directory.

 

If however you only want to change the default group for some files but not for all files, you can issue UNIX commands from your SAS program using %sysexec

 

For example, here I'm issuing a df -k command which will put a listing of the space allocations on my UNIX server into a text file called df_-k.txt

 

/** Create a listing of the space allocations on UNIX server. **/
%sysexec %str(df -k > /home/barbourj/df_-k.txt);

Using %sysexec, you could just as easily issue chmod commands.

 

Hope that helps,

 

Jim

 

View solution in original post

2 REPLIES 2
jklaverstijn
Rhodochrosite | Level 12

Hi Go,

 

You can force the group of a file by setting the set-group-ID bit of the containing directory. If a directory’s set-group-ID bit is set, newly created subfiles inherit the same group as the directory. So in addition you should also set the group of that directory to the desired group as a one-time command.

 

You can set the set-group-ID bit and change its group as follows:

 

# chmod g+s mydir

# chgrp yyy mydir

 

Existing files in the directory will not be affected.

 

Hope this helps,

Regards Jan.

jimbarbour
Meteorite | Level 14

Jan's suggestion, above is a good one, and probably the best if you don't mind changing the default group for the entire directory.

 

If however you only want to change the default group for some files but not for all files, you can issue UNIX commands from your SAS program using %sysexec

 

For example, here I'm issuing a df -k command which will put a listing of the space allocations on my UNIX server into a text file called df_-k.txt

 

/** Create a listing of the space allocations on UNIX server. **/
%sysexec %str(df -k > /home/barbourj/df_-k.txt);

Using %sysexec, you could just as easily issue chmod commands.

 

Hope that helps,

 

Jim

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2 replies
  • 2208 views
  • 5 likes
  • 3 in conversation