Hi,
I am working with Sas Viya 3.5.
i created this fedsql . the calculate variables NO_TARGET1, NO_TARGE0 and NO_CONNECTIONS become a datatype int32 and int64.
proc fedsql sessref=RAN_Insight;
drop table xx.connt_s1 force;
create table xx.connt_s1 as
SELECT x.RI_DATE
, x.dd
, x.dd2
, sum(case when target=1 then 1 else 0 end) as no_target1
, sum(case when target=0 then 1 else 0 end) as no_target0
, count(*) as no_connections
FROM xx.LAG_4G_weak x
inner join xx.connt_s y on (x.dd= y.dd)
Group by x.RI_DATE, x.dd, x.dd2;
QUIT;
when I execute a proc means on the result of this fedsql, I got an error that 'ERROR: The analytic variable's data type is not supported.'
How can I force in the fedsql that the 'int32' variables become double?
You can use the CAST function to convert data types, see example below:
proc fedsql sessref=sugus;
drop table casuser.cars_aggr force;
create table casuser.cars_aggr as
select
type
, sum(case when origin = 'Europe' then 1 else 0 end)::double as eur_cars
, cast(sum(case when origin = 'Europe' then 1 else 0 end) as double) as eur_cars2
from
casuser.cars
group by
type
;
quit;
You can use the CAST function to convert data types, see example below:
proc fedsql sessref=sugus;
drop table casuser.cars_aggr force;
create table casuser.cars_aggr as
select
type
, sum(case when origin = 'Europe' then 1 else 0 end)::double as eur_cars
, cast(sum(case when origin = 'Europe' then 1 else 0 end) as double) as eur_cars2
from
casuser.cars
group by
type
;
quit;
that solve the problem. But isn't it strange that proc means cannot handle int32 data type. i cannot in the documentation that the data type should be double.
i see now the procedures cannot handle int32 and int64.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.