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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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