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

I have used the following procedure (from an old SAS proceedings 046-2010) to copy variable names to the clipboard in SAS V9.2:

Click on the Explorer window.

Tools/Options/Explorer/Members/Table/Edit

Add new entry.

Copy Variable &Names to Clipboard

gsubmit "filename _cb clipbrd;data _null_;file _cb;dsn='%8b'||'.'||'%32b';length N $32;do dsid=open(dsn,'I') while(dsid ne 0);do i=1 to attrn(dsid,'NVARS');N=', '||varname(dsid,i);put N;en;dsid=close(dsid);end;run;filename _cb clear;";

Is there a way to do the same in EG 4.3?

I know I can click on properties, columns and click copy to Clipboard, but I get a whole lot more than just the column names separated by commas.

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

@csc,

 

And...here's the task! Glad that I was able to demo it for you in Las Vegas at the Analytics 2015 conference.  It's events like this that can make things happen!

 

You can download the task from the SAS support site as a ZIP file.  The instructions for installation and use are in the README.txt in the ZIP file.

 

When you add the task, you'll see three new entries under Tools->Add-In->Data Utilities.

 

copycols.png

Each one copies the column names (variable names) from the active SAS data set in a slightly different format: CSV on one line, CSV on multiple lines, and just a straight list with names one-per-line, no separator.

 

Enjoy!

Chris

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

5 REPLIES 5
LinusH
Tourmaline | Level 20

There are many ways to get the variable name from a SAS data set (in EG), but the example you provide doesn't for obvious reasons: the clipboard is on the client (where EG is executing), but the SAS code is executing on the server, and are not client aware.

To help with an alternative solution, you can help by telling when, and how you wish to use the variable lists.

Data never sleeps
csc
Calcite | Level 5 csc
Calcite | Level 5

Often I am using a file that I did not create.  I then need a variety of fields from that file in subsequent code.  The PC SAS code above allows me to right click on the file in Explorer and choose "Copy Variable names to Clipboard", which will give me the following when I paste:

, variable1

, variable2
, variable3

, etc,

Being a long time PC SAS user and new to EG, I thought for sure there was a way to replicate this shortcut.

A custom task sounds interesting.

Tom
Super User Tom
Super User

Looks like you need a custom task in Enterprise Guide.  Perhaps Chris@SAS can show use how?

ChrisHemedinger
Community Manager

Hi @csc,

 

Great to see you at Analytics 2015.  As we discussed (and I'm sharing here for the group), you might be able to use this data set->DATA step custom task to accomplish this.  Not sure that it's quite as easy as what you want, but it's a start.

 

Otherwise, it's a good idea for a specific custom task.  I'll add that to my (growing) list of useful ideas.

 

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
ChrisHemedinger
Community Manager

@csc,

 

And...here's the task! Glad that I was able to demo it for you in Las Vegas at the Analytics 2015 conference.  It's events like this that can make things happen!

 

You can download the task from the SAS support site as a ZIP file.  The instructions for installation and use are in the README.txt in the ZIP file.

 

When you add the task, you'll see three new entries under Tools->Add-In->Data Utilities.

 

copycols.png

Each one copies the column names (variable names) from the active SAS data set in a slightly different format: CSV on one line, CSV on multiple lines, and just a straight list with names one-per-line, no separator.

 

Enjoy!

Chris

 

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 5 replies
  • 8033 views
  • 1 like
  • 4 in conversation