turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- skewness and kurtosis in proc sql

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-04-2015 12:03 AM

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

Table: WORLDTEMPS

The following statement illustrates the SKEWNESS function:

Statements Results

select skewness(AvgHigh) from worldtemps; -0.69811

Accepted Solutions

Solution

08-04-2015
03:39 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-04-2015 03:39 PM

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 --<-----

All Replies

Solution

08-04-2015
03:39 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-04-2015 03:39 PM

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 --<-----

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-12-2015 11:59 PM

Thanks a lot for the explanation.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-13-2015 08:55 AM

As Jaap pointed out.

It is

PROC FEDSQL;

not

PROC SQL;