how can get the first and last observations in a dataset
using Proc SQl?

Answer Posted / venkatesh layam

crate one data in sql with adding of new var (a = 1) and
sort(order by) descending order by another variable and
take distinct of a (newvar-which is already created) --then
u wil get last observation.

next do ascending and get first obs ,then union these two
data sets .u will get first and last obs.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do the PUT and INPUT functions do?

765


How to limit decimal places for the variable using proc means?

587


Give some ways by which you can define the variables to produce the summary report (using proc report)?

587


How does proc sql work?

604


This entry was posted in General. Bookmark the permalink. Post a comment or leave

4006






What are the statements in proc sql?

579


What are the different versions of sas that you have used until now? : sas-grid-administration

715


What is the difference between the proc sql and data step?

648


Explain the difference between using drop = data set option in set and data statement?

671


what is slowly changing dimension? : Sas-di

609


what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?

1671


I have a dataset concat having a variable a b & c. How to rename a b to e & f?

741


Give e an example of..

1829


if a variable contain dates like "2015/01"---"2015/12" (yymm) ,How to add day to those dates,if them month is jan then 31 if the month is feb then 28 so on ...

930


What is the maximum and minimum length of macro variable

642