BookmarkSubscribeRSS Feed
Nietzsche
Lapis Lazuli | Level 10

trying to understand my mate's code. I have never seen this before but what does in (.) mean?

 

Nietzsche_1-1679228043112.png

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
9 REPLIES 9
Nietzsche
Lapis Lazuli | Level 10

I see. why not just not missing? so much easier to read.

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
PaigeMiller
Diamond | Level 26
not missing(adj_fac)

 

 

works too. There are many ways to do this.

--
Paige Miller
yabwon
Onyx | Level 15

..or:

if adj_fac > .z then ...

🙂

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



yabwon
Onyx | Level 15

But those two are not equivalent.

1    data test;
2      adj_fac = .B;
3      if adj_fac ne . then x1=1;
4      if not missing(adj_fac) then x2=1;
5      put _all_;
6    run;

adj_fac=B x1=1 x2=. _ERROR_=0 _N_=1

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



ballardw
Super User

@Nietzsche wrote:

I see. why not just not missing? so much easier to read.


For any question relating to "WHY" you must ask the programmer.

I can see a scenario where a prior version of the programming used a list of values with or without the missing. Then needs changed and the list was reduced or replaced leaving the . as the only list.

 

I have code where I have some code like " IN ('one value') " instead of "variable = 'one value' " because history has shown me that I am very likely to have to add values.

 

 

Tom
Super User Tom
Super User

They probably used to have other values in the list of excluded values.

if adj_fac not in (. 0 -1 999) then ...

And they removed the others and did not bother to change from the IN operator to equality operator once there was only one value left in the list.

tarheel13
Rhodochrosite | Level 12

it means adj_fac was not missing. I wouldn't have written it that way. I prefer the missing function like others have mentioned here.

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
  • 9 replies
  • 1129 views
  • 3 likes
  • 7 in conversation