Hi, I have to add a numeric variable to an existing dataset. I then used this code :
data WANT;
set HAVE;
put INDIC_2009 8.;
format INDIC_2009 comma8.2;
datalines;
38,64
.
.
.
-18,36
0,36
0,36
-88,96
0,12
-88,96
-53,66
0,2
-21,344
2
3
-88,96
-88,96
-18,36
-88,96
0,12
-53,66
0,12
0,12
0,36
0,36
0,36
-107,32
0,6
-106,72
;
run;
But it does not work. I only get "."
Any idea ?
Thank you !
Look at the data set HAVE. Is the variable INDIC_2009 character or numeric? Are there errors or warnings in the LOG?
I added an INFILE and an INPUT statement to your Data step, and it seems to be working. See code, below, and see results, below the code. I also changed the commas to decimal points, but I am based in the US, so a comma may be valid where you are.
data WANT;
set HAVE;
* put INDIC_2009 8.;
format INDIC_2009 comma8.2;
INFILE Datalines;
INPUT INDIC_2009;
Jim
Results:
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!
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.