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

My SAS version is 9.4 TS Level 1M2

.I tried something like below, it didn't work, the log error is about:

ERROR: Function SKEWNESS requires at least 3 argument(s).

ERROR: Function KURTOSIS requires at least 4 argument(s).

%let window=2;

proc sql;

create table want as

   select *,

   (select skewness(var_x) from have where id=a.id and year between a.year and (a.year + &window)) as var_x_skewness,

   (select kurtosis(var_x) from have where id=a.id and year between a.year and (a.year + &window)) as var_x_kurtosis

from have as a;

quit;

Then I searched online, looks like both functions can't use directly in proc sql.

but I also found something  as highlighted below in the following link,

SAS(R) 9.4 FedSQL Language Reference, Fourth Edition

The following statement illustrates the SKEWNESS function:

Statements                                                             Results

select skewness(AvgHigh) from worldtemps;             -0.69811

1 ACCEPTED SOLUTION

Accepted Solutions
jakarman
Barite | Level 11

You are mixing up several concepts.

- Skewness can be computed as of some tables (sas-datasets) This is done with SAS by proc usage means/univariate Base SAS(R) 9.2 Procedures Guide

  The calculation is done horizontally. This is normal classic sas usage.

- Skewness can be calculated on some number of variables in a records.. SAS has a function for that SAS(R) 9.4 Functions and CALL Routines: Reference, Fourth Edition

- With Proc Sql SAS kept that on the ANSI 99 standard not following it to 2013 (interval group calculations)

  When coding whit that SQL you can call the SAS functions (horizontally) not the SQL vertically grouping way

- With PROC FEDSQL you have a part of a new SQL ANSI  version grouping is mentioned hey have been implemented as addons with aggregate functions (sql:99)  
  intended to be used with DS2 and supporting skewness vertical and horizontal     

---->-- ja karman --<-----

View solution in original post

3 REPLIES 3
jakarman
Barite | Level 11

You are mixing up several concepts.

- Skewness can be computed as of some tables (sas-datasets) This is done with SAS by proc usage means/univariate Base SAS(R) 9.2 Procedures Guide

  The calculation is done horizontally. This is normal classic sas usage.

- Skewness can be calculated on some number of variables in a records.. SAS has a function for that SAS(R) 9.4 Functions and CALL Routines: Reference, Fourth Edition

- With Proc Sql SAS kept that on the ANSI 99 standard not following it to 2013 (interval group calculations)

  When coding whit that SQL you can call the SAS functions (horizontally) not the SQL vertically grouping way

- With PROC FEDSQL you have a part of a new SQL ANSI  version grouping is mentioned hey have been implemented as addons with aggregate functions (sql:99)  
  intended to be used with DS2 and supporting skewness vertical and horizontal     

---->-- ja karman --<-----
Jonate_H
Quartz | Level 8

Thanks a lot for the explanation.

Ksharp
Super User

As Jaap pointed out.

It is

PROC FEDSQL;

not

PROC SQL;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 4735 views
  • 0 likes
  • 3 in conversation