I have a code with a data set with a variable titled average with the average housing prices by month since 1975. These observations are in char format and need to be converted to numerics. The code is below:
data mortdata.housingproces; set mortdata.house_price;
AVG = input(average, Best5.);
run;
This isn't working, and I'd like to know why. The output that I keep getting is just "." for all the rows.
Thank you for your help in advance!
Does you text value have commas? Show some example values, what you are currently getting for results and what you expect.
BEST5 seems low for house prices, have you tried BEST12?
Post your log as well please.
Post your code and log.
Does you text value have commas? Show some example values, what you are currently getting for results and what you expect.
My text values had commas in them, and I removed them right now. The results are now populating. Thank you so much for y'all's help!
The informat represents the format your data was in.
So it should have been something like:
input(average, comma12.);
data mortdata.housingproces; set mortdata.house_price;
AVG = average+0;
run;
@ShiroAmada wrote:
data mortdata.housingproces; set mortdata.house_price;
AVG = average+0;
run;
Implicit conversion isn't a great idea in the long run. It will leave notes in the log and make it hard to distinguish actual errors, if they crop up later on.
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: