BookmarkSubscribeRSS Feed
nicopark
Calcite | Level 5

Hey all,

I'm new and am stuck on how to subtract one column from another - both are numeric and have a year (ex. 1994) as well as a number in parentheses matching the year (ex. 94). So each value looks like "(94) 1994", or in another example "(81) 1981". When I subtract the two values from another, I get some funky answers (negative and exponential). What's a good way of getting rid of one of the values for a large dataset and completing the subtraction task?


1 REPLY 1
Astounding
PROC Star

The first step begins with finding out what the variables actually contain.  Taking your word for it that the variables are actually numeric, the only way that parentheses print is because the variables are printed with a format.  So you have to remove the format and print a few actual values to get some idea of what the variables contain.  Luckily, that is easy:

proc print data=have (obs=20);

var column1 column2;

format column1 column2;

run;

After that, it's possible that you will have enough information to perform the subtraction.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 651 views
  • 0 likes
  • 2 in conversation