DATA Step, Macro, Functions and more

Trying to stack three datasets in one

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

Trying to stack three datasets in one

proc sql;
create table final_data_set as

select  field_name
	, value1
from HSD.types_OfAttempts

UNION ALL

select put(field_name, Z3.) 
	, 	 value1 

from HSD.number_attempts


UNION ALL


select put(field_name, Z3.) 
	, value1

from HSD.final_timeframes
;
quit;

The first dataset has field_name as character. It has types of attempts made like phone, email, face2face.

 

The last two datasets have field_name as numeric.

 

ERROR: Numeric format Z in PUT function requires a numeric argument.


Accepted Solutions
Solution
‎05-26-2016 12:01 PM
Super User
Posts: 17,881

Re: Trying to stack three datasets in one

Well, your  error message contradicts your statements regarding the variable type.

 

Review the proc contents output of each of your three datasets and modify your code accordingly.

 

If that still does not work, post the results of your proc contents.

 

 

 

 

 

 

View solution in original post


All Replies
Solution
‎05-26-2016 12:01 PM
Super User
Posts: 17,881

Re: Trying to stack three datasets in one

Well, your  error message contradicts your statements regarding the variable type.

 

Review the proc contents output of each of your three datasets and modify your code accordingly.

 

If that still does not work, post the results of your proc contents.

 

 

 

 

 

 

Occasional Contributor
Posts: 19

Re: Trying to stack three datasets in one

I figured it was a silly mistake.

I did a proc contents and matched the variable type Smiley Happy

Thanks so much guys.

Frequent Contributor
Posts: 102

Re: Trying to stack three datasets in one

Check that your Field_Name variables in the second and third datasets are in fact numeric. Alternatively, you can have this error if you misspell the dataset name and the variable is not found.
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 238 views
  • 1 like
  • 3 in conversation