BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sk1_SAS
Obsidian | Level 7

i have a table with negative percent

format of the variable: percentn10.2

 

Sk1_SAS_0-1627766054931.png

 

i have tried: where variable < 0, but does not work, do you know why?

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@Sk1_SAS WHAT is not working. Please also provide sample data in the form of a data step as done below and not as a screenshot.

Just wildly guessing: I could imagine that you could get an unexpected result if you condition was variable <= 0  Not sure about variable <0

Best provide sample data and your selection and tell us where your condition doesn't work as you'd expect.

data have;
  input variable;
  format variable percentn10.2;
  datalines;
-0.0016
-0.0166
0
0.000001
-0.000001
;

proc print data=have;
  where variable<0;
run;

 Patrick_0-1627777741454.png

 

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

What do you mean by "does not work"? Please state what happens, in enough details so I can understand what you are seeing, or show us the incorrect results.

 

Please show us the full LOG of the code you are running, so we can see the code as it is displayed in the log, plus any ERRORs, WARNINGs and NOTEs. Do not chop out parts of the log. Do not pick and choose parts of the log to show us, and then not show us other parts.

--
Paige Miller
Patrick
Opal | Level 21

@Sk1_SAS WHAT is not working. Please also provide sample data in the form of a data step as done below and not as a screenshot.

Just wildly guessing: I could imagine that you could get an unexpected result if you condition was variable <= 0  Not sure about variable <0

Best provide sample data and your selection and tell us where your condition doesn't work as you'd expect.

data have;
  input variable;
  format variable percentn10.2;
  datalines;
-0.0016
-0.0166
0
0.000001
-0.000001
;

proc print data=have;
  where variable<0;
run;

 Patrick_0-1627777741454.png

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 620 views
  • 2 likes
  • 4 in conversation