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

Hello,

I have a dataset with 100 records which are basically the LAN_IDs of users. I want to know what all AD groups they're in. I basically run, id lan_id from the Linux command line. I hate doing that for all the 100 users.

How do I succeed using XCMD programmatically from Enterprise Guide?

 

Please suggest!

 

TIA,
Akshay.

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Then you can use the "magic dynamic pipe":

data usernames;
input name $8.;
datalines;
lan_id
;

data userdata;
set usernames;
length pipevar $20;
pipevar = "id " !! name;
infile dummy pipe filevar=pipevar end=done;
do until (done);
  input uidstring :$20. gid_string :$20. group_string :$500.;
  output;
end;
run;

This algorithm is part of a presentation planned for SASGF 2021 in Las Vegas.

View solution in original post

7 REPLIES 7
andreas_lds
Jade | Level 19

The option xcmd must be enabled on the workspace-server you are using. If is is enabled, you can use filename with pipe to execute a command an process the result using a data-step.

Akshay1002
Fluorite | Level 6
Yes, I've XCMD enabled and able to successfully execute the below followed by a data step.
filename dirlist pipe "id lan_id";

How to do it for 100 users?
Can you please help me with the code?
Akshay1002
Fluorite | Level 6
Yes, Sir.
Basically importing a spreadsheet with the usernames.
Kurt_Bremser
Super User

Then you can use the "magic dynamic pipe":

data usernames;
input name $8.;
datalines;
lan_id
;

data userdata;
set usernames;
length pipevar $20;
pipevar = "id " !! name;
infile dummy pipe filevar=pipevar end=done;
do until (done);
  input uidstring :$20. gid_string :$20. group_string :$500.;
  output;
end;
run;

This algorithm is part of a presentation planned for SASGF 2021 in Las Vegas.

Akshay1002
Fluorite | Level 6

You're A W E S O M E!

 

It worked. Thanks a lot.

SASKiwi
PROC Star

The XCMD option can only be set as an option when you start SAS so it can't be done in EG. Your SAS Administrator can set it via SAS Management Console or a SAS config file.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 1568 views
  • 5 likes
  • 4 in conversation