10-24-2024
kajal_30
Quartz | Level 8
Member since
02-05-2019
- 191 Posts
- 6 Likes Given
- 3 Solutions
- 4 Likes Received
-
Latest posts by kajal_30
Subject Views Posted 912 10-09-2024 02:14 PM 933 10-09-2024 02:01 PM 963 10-09-2024 01:25 PM 1492 10-09-2024 12:26 PM 1610 10-08-2024 05:09 PM 1864 10-07-2024 01:01 PM 1897 10-07-2024 12:31 PM 1915 10-07-2024 12:20 PM 1928 10-07-2024 12:09 PM 1273 09-25-2024 03:07 PM -
Activity Feed for kajal_30
- Posted Re: Need max value for each group by column on SAS Programming. 10-09-2024 02:14 PM
- Posted Re: Need max value for each group by column on SAS Programming. 10-09-2024 02:01 PM
- Posted Need max value for each group by column on SAS Programming. 10-09-2024 01:25 PM
- Posted Re: need first and last record in the form of sql on SAS Programming. 10-09-2024 12:26 PM
- Posted Re: need first and last record in the form of sql on SAS Programming. 10-08-2024 05:09 PM
- Posted Re: need first and last record in the form of sql on SAS Programming. 10-07-2024 01:01 PM
- Posted Re: need first and last record in the form of sql on SAS Programming. 10-07-2024 12:31 PM
- Posted Re: need first and last record in the form of sql on SAS Programming. 10-07-2024 12:20 PM
- Posted need first and last record in the form of sql or datastep on SAS Programming. 10-07-2024 12:09 PM
- Posted Re: Loop in dates for %macro function on SAS Programming. 09-25-2024 03:07 PM
- Posted Re: Loop in dates for %macro function on SAS Programming. 09-25-2024 02:56 PM
- Posted Re: Loop in dates for %macro function on SAS Programming. 09-25-2024 02:17 PM
- Posted update statement using if statement on SAS Programming. 09-25-2024 02:15 PM
- Posted Re: Loop in dates for %macro function on SAS Programming. 09-25-2024 01:42 PM
- Posted Loop in dates for %macro function on SAS Programming. 09-25-2024 12:42 PM
- Posted Re: Assign -ve numeric value to macro variable on SAS Programming. 09-19-2024 05:36 PM
- Posted Re: Assign -ve numeric value to macro variable on SAS Programming. 09-19-2024 05:06 PM
- Posted Re: Assign -ve numeric value to macro variable on SAS Programming. 09-19-2024 04:46 PM
- Posted Re: Assign -ve numeric value to macro variable on SAS Programming. 09-19-2024 03:27 PM
- Posted Re: Assign -ve numeric value to macro variable on SAS Programming. 09-19-2024 02:03 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 01-25-2022 01:34 PM 1 01-20-2022 10:27 PM 1 03-11-2020 04:46 PM 1 04-15-2019 03:11 PM
10-09-2024
02:14 PM
I also need to do a join so I am not able to use the join with the proc that's why It will easier for me to use Proc sql Thanks
... View more
10-09-2024
02:01 PM
can I please get in terms of proc sql as I have many more columns to add along with the join . Regards kajal
... View more
10-09-2024
01:25 PM
Hi All, I have below data set (have) and need output like below(need) : TIA DATA HAVE; INPUT ID PRICE YEARMONTH; CARDS; 1 23 2312 1 24 2401 1 25 2402 1 36 2403 2 45 2312 2 34 2401 2 53 2402 2 23 2403 2 664 2404 ; RUN; DATA need; INPUT ID PRICE YEARMONTH; CARDS; 1 36 2403 2 664 2404 ; RUN; PROC SQL;
SELECT * FROM HAVE
GROUP BY ID ,YEARMONTH
HAVING MAX(YEARMONTH) ;
QUIT;
... View more
10-09-2024
12:26 PM
thank you so much regards kajal
... View more
10-08-2024
05:09 PM
Thank you so much multiple solution worked but I got one more challenge with the data as below. can we please accommodate the same data have; input ID PRICE YEARMONTH; cards; 1 . 2312 1 455423 2402 1 455404 2403 1 455405 2404 2 455406 2312 2 455407 2402 2 455408 2403 2 455409 2404 2 455405 2409 2 . 2410 3 455407 2402 3 455408 2403 3 455409 2404 3 455402 2405 3 455403 2406 3 455404 2407 3 455404 2408 3 455405 2409 ; RUN; data expect ; input ID PRE_PRICE PRE_YEAR POST_PRICE POST_YEAR ; cards; 1 455423 2402 455405 2404 2 455406 2312 . 2410 3 455407 2402 455405 2409 ; run; while doing the first. we cannot have null value so pre_ value should go to next non null value but post_ value can have null. I am stuck as we can not simply put where price is not null as it will also eliminate null values for post TIA kajal
... View more
10-07-2024
01:01 PM
Thank you can also please share the data step code and as my code is selecting all obs. data want;
set have ;
by yearmonth ;
if first.yearmonth then pre_price = price and pre_year = yearmonth;
output;
if last.yearmonth then post_price = price and post_year = yearmonth ;
output;
run; TIA kajal
... View more
10-07-2024
12:31 PM
I am talking about SAS SQL only we are not prioritizing other language our milestone is to get the SAS code working. So you are saying it is not possible in SAS to use sql to get this output ?
... View more
10-07-2024
12:20 PM
its a requirement from the client as they need most of the code in sql to be run on other applications with different language than SAS for comparing results.
... View more
10-07-2024
12:09 PM
Hello all I have a dataset like below (have) and need an output (want) Please help me with the code in terms of proc sql or data step TIA HAVE WANT ID PRICE YEARMONTH ID PRE_PRICE PRE_YEAR POST_PRICE POST_YEAR 1 455412 2312 1 455412 2312 455405 2404 1 455423 2402 2 455406 2312 455409 2410 1 455404 2403 3 455407 2402 455405 2409 1 455405 2404 2 455406 2312 2 455407 2402 2 455408 2403 2 455409 2404 2 455405 2409 2 455409 2410 3 455407 2402 3 455408 2403 3 455409 2404 3 455402 2405 3 455403 2406 3 455404 2407 3 455404 2408 3 455405 2409
... View more
09-25-2024
03:07 PM
did try that but creating table only for one date not sure why data test;
infile datalines;
input date ;
datalines;
202401
202402
202003
202404
202505
202406
;
run;
proc sql;
select date into : to_dt separated by ' ' from test ;
quit;
%put &to_dt. ;
%macro dt (list);
proc sql;
create table sample_&dt. as
select * from cars
;
quit;
%mend dt;
%dt (list= &to_dt.) ;
... View more
09-25-2024
02:56 PM
so there isn't a method to assign a list of values while calling a macro in sas ? %date_to_months(&dt_mnth.) ? where dt_mnth = 202312 202311 202301 202302 202304 202305 202306 202307 202308 202309 kajal
... View more
09-25-2024
02:17 PM
Because monthly data is in all different monthly tables so fetch the data from each monthly table first and then update the master table otherwise I might have updates the table from one big table with all months. Kajal
... View more
09-25-2024
02:15 PM
I am trying to update one column in one table using value from another table as below. Is there a way to update the column only if it has null value or else keep the previous value and do no updates. Please let me know what wrong I am doing in the code below. proc sql;
update table customer a
set a.pre_diags =
case
when a.pre_diags is null then b.pre_diags
else a.pre_diags
end
from retails b;
quit; Regards Kajal
... View more
09-25-2024
01:42 PM
long story short : I have master dataset which will get updated values from the monthly tables. each value in the master table corresponds to values (to be updated in master) in different monthly table. so I am creating monthly tables with all the updated values and then each monthly table will update master table on the basis of each month . Hope that helps! Kajal
... View more
09-25-2024
12:42 PM
Hi all , I am trying to run the same programs using different dates. Is it possible to run this program using 30 dates at once putting those dates under one macro variable as below? if there is a better way to do this please let me know. proc sql;
select curr_dt into : to_dt from customer ;
quit;
%put &to_dt ;
logs:
202401
202402
202403
202404
202405
202407
202408
202409
202406
%macro (dt );
proc sql;
create table sample_&dt. as
select * from data where date = &dt.
;
quit;
%mend ( &to_dt); Thanks Kajal
... View more