BookmarkSubscribeRSS Feed
lukesirakos
Fluorite | Level 6

In using EG (v 7.13) there are many times I want to copy a dataset and paste it in Excel to do some ad-hoc analysis that is easier that way. When I do this I always want to include the headers but if I use the copy shortcut (Ctrl+C) it defaults to just copying the data without the headers included. Is there an option I am not aware of to change the default to copy with headers? I know I can right click and do it that way but I would prefer to use the shortcut as it is what I do instinctively.

 

Thanks

3 REPLIES 3
ChrisHemedinger
Community Manager

No, there isn't a keyboard shortcut for "Copy with Headers" -- it's a right-click action.

 

But you could use a tool like AutoHotkey to map your own shortcuts (for EG or for any Windows application).

 

 

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

I know what it's like to have a customary way of doing things, and ordinarily I wouldn't interfere, but I would REALLY REALLY like to suggest you give the "Send To"..."Microsoft Excel" functionality a try. I wouldn't do it any other way; the headings come out right, Excel doesn't try to interpret any "funky" data that comes across, dates and times are good.

 

I'll offer you DOUBLE your money back! If you don't like it, I'll refund you TWO TIMES what you paid for this tip!! Robot Happy

 

Tom

rogerjdeangelis
Barite | Level 11
If you happen to have 'full'  local SAS with the 'old text editor' you can do the following.

Suppose you have this code in your editor

data class;
  set sashelp.class;
run;

Highlight either sashelp.class or class and type 'xlsh' on the clean command line. Excel will open with the the sasdatset imported.

==> xlsh

You can also put the command macro on a function key. (highlight - hit key fyi macro xls for last dataset)
SAS removed this functionality in all editors after the old text editor.
The command macro has to be in your autocall library.

I also have shift-rmb to list 40 obs from last dataset with obs number.
and many more. Much faster that SAS viewer and you can cut and paste.

and excel will open with the SAS dataset importted.

%macro xlsh /cmd ;
   store;note;notesubmit '%xlsha;';
   run;
%mend xlsh;

%macro xlsha/cmd;

    filename clp clipbrd ;
    data _null_;
     infile clp;
     input;
     put _infile_;
     call symputx('argx',_infile_);
    run;

    %let __tmp=%sysfunc(pathname(work))\myxls.xlsx;

    data _null_;
        fname="tempfile";
        rc=filename(fname, "&__tmp");
        put rc=;
        if rc = 0 and fexist(fname) then
       rc=fdelete(fname);
    rc=filename(fname);
    run;

    libname __xls excel "&__tmp";
    data __xls.%scan(__&argx,1,%str(.));
        set &argx.;
    run;quit;
    libname __xls clear;

    data _null_;z=sleep(1);run;quit;

    options noxwait noxsync;
    /* Open Excel */
    x "'C:\Program Files\Microsoft Office\OFFICE14\excel.exe' &__tmp";
    run;quit;

%mend xlsha;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 3487 views
  • 3 likes
  • 4 in conversation