rohit bedi


{ City } faridabad
< Country > india
* Profession * consulting
User No # 118699
Total Questions Posted # 0
Total Answers Posted # 2

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 0
Users Marked my Answers as Wrong # 0
Questions / { rohit bedi }
Questions Answers Category Views Company eMail




Answers / { rohit bedi }

Question { Verinon Technology Solutions, 7854 }

DATA ABC;
INPUT TDATE DATE9. AVG;
CARDS;
18APR2008 150.00
19APR2008 167.00
20APR2008 123.00
21APR2008 145.00
;
RUN

HOW CAN I FIND THE DIFFERENCE BETWEEN AVG OF 18APR2008 ANF
21APR2008??

IF ANY ONE GETS IT PLS TRY TO POST IT.


Answer

Shortest answer: Copy the dataset and create a new field using difn function on avg where n=3 as shown below.

data abc2;
set abc;
diff = dif3(avg);
run;

Is This Answer Correct ?    0 Yes 0 No

Question { Satyam, 11737 }

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


Answer

Create a new data set as below:

data demo;
input year month cpi;
datalines;
1990 6 129.9
1990 7 130.4
1990 8 131.6
1990 9 132.7
1991 4 135.2
1991 5 135.6
1991 6 136.0
1991 7 136.2
;
run;

Sort the data if needed.

Create a new id field:

data demo2;
set demo;
id = _n_;
run;

Display the first and last record for every date and finally remove the id column.

proc sql;
create table final as select * from demo2 where id in (select min(id) from demo2 group by year) or id in (select max(id) from demo2 group by year);
alter table final drop column id;
quit;

Is This Answer Correct ?    0 Yes 0 No