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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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