BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hansdewit
Obsidian | Level 7

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

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;

View solution in original post

4 REPLIES 4
BrunoMueller
SAS Super FREQ

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;
Hansdewit
Obsidian | Level 7

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.

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!

Discussion stats
  • 4 replies
  • 659 views
  • 0 likes
  • 2 in conversation