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

Hi

I have been given a set of sas scripts (40 odd scripts) written in SAS without documentation of the inter-relationships between the .SAS files.

I am not trying to reverse engineer it but just trying to understand the derivation of certain variables of interest only.

 

eg 

if P26v = 1 then mb1 = 1;
else if P26u IN(5,8,9) or M26v = 5 then md6 = 5;
else mb1 = D26v;

if P26Q = 1 or P26W = 1 or P26P = 1 then md8 = 1;
else if M26A = 5 or M26F = 7 or P26P = 3 then md8 = 2;
else if P26Q = 8 or D26W = 8 or D26R = 8 then md8 = 8;

 

i would like to extract out the lines

> else if P26u IN(5,8,9) or M26v = 5 then md6 = 5;

> else if M26A = 5 or M26F = 7 or P26P = 3 then md8 = 2;

 

may i know is there a script where i can run such that i can specify regular expression '/\bM\w+/' and the lines that contains a variable starting with M followed by some numberic can be extracted ?

 

I used chatgrp for help but it is not working out for me. I only manage to get the script to iterate all the .SAS files but the part to look for variable of specific pattern is just not working out for me. I wish to seek some advice how can i go about it please.

 

Thank you

BY

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

It wouldn't be hard to write such a script.

What I would do: Download and open all these 40 .sas files with Notepad++ and do the search there (Notepad++ also allows for RegEx searches). I used to use Atom in the past for such impact analysis - but it has unfortunately been discontinued.

View solution in original post

1 REPLY 1
Patrick
Opal | Level 21

It wouldn't be hard to write such a script.

What I would do: Download and open all these 40 .sas files with Notepad++ and do the search there (Notepad++ also allows for RegEx searches). I used to use Atom in the past for such impact analysis - but it has unfortunately been discontinued.

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
  • 1 reply
  • 558 views
  • 0 likes
  • 2 in conversation