BookmarkSubscribeRSS Feed
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

Is there a keyboard shortcut--like there is in RStudio--that copies the current line of code to the next line.

 

/* For example: I may want to duplicate a class statement for another procedure. I often find that I need to re-use a line in another procedure*/

PROC LOGISTIC DATA=HAVE
   CLASS X Y Z;
   MODEL A = X Y Z;
   RUN;

PROC LOGISTIC DATA =NEXT;
  /*PUT COPIED STATEMENT HERE*/

   

 

That shortcut is Shift+Alt+Down arrow in RStudio. I could not find such a shortcut in the list of shortcuts in EG, but perhaps I'm overlooking something.

 

 

3 REPLIES 3
Reeza
Super User

I don't think that's an option, which sort of makes sense in SAS, the lines don't build on one another like they do in R. Can you give an example of how/when that would be used? It woudn't make sense for the example you posted since you would never have two proc statements back to back like that.

 


@svh wrote:

Is there a keyboard shortcut--like there is in RStudio--that copies the current line of code to the next line.

 

/* For example: I may want to duplicate a class statement for another procedure. I often find that I need to re-use a line in another procedure*/

PROC LOGISTIC DATA=HAVE
   CLASS X Y Z;
   MODEL A = X Y Z;
   RUN;

PROC LOGISTIC DATA =NEXT;
  /*PUT COPIED STATEMENT HERE*/

   

 

That shortcut is Shift+Alt+Down arrow in RStudio. I could not find such a shortcut in the list of shortcuts in EG, but perhaps I'm overlooking something.

 

 


 

svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10

That was admittedly a poor example, but I work with a lot of data that needs to be recoded, so I'm frequently writing lines like the following:

 

else if Q2 = 2 then Program = 'Emergency Medicine';

 

It's rather easy to copy the line with a quick keyboard shortcut. But thank you for pointing out that this is not a feature in SAS EG.

 

Reeza
Super User
For recoding, I highly recommend looking into PROC FORMAT, it's quite powerful and avoids having to do multiple IF/THEN statements.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 501 views
  • 0 likes
  • 2 in conversation