BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hydro1
Fluorite | Level 6
 Dear SAS Community:I have a dataset of daily values of river flow for a number of years (I couldn't attach the SAS dataset so I pasted two years of data below).  For each year I have computed 25%, 50%, and 75% of the annual flow volume( not to be confused with actual univariate quantiles) and wish to know (e.g. output)  the date (within each year) that these percentage values are reached (by summing variable Qcoraf) ?  I have tried to do this using a DO UNTIL loop (below)  and output statement and did not get the desired results--I suspect that my program is naive and much too simple.  Please advise--Thank You ! data new2;
total=0;
set new1;
do i='01Jan1930'd to '01Jan2015'd  until (total>=Q25);
Total=Total+Qcorcfs;
date=i;
output;
end;
run;  
 
 

 

1360.6601JAN1940111940420185.91840371.831260557.74
1382.4802JAN1940211940420185.91840371.831260557.74
1392.4003JAN1940311940420185.91840371.831260557.74
1404.3004JAN1940411940420185.91840371.831260557.74
1392.4005JAN1940511940420185.91840371.831260557.74
1348.7606JAN1940611940420185.91840371.831260557.74
1313.0607JAN1940711940420185.91840371.831260557.74
1328.9308JAN1940811940420185.91840371.831260557.74
1348.7609JAN1940911940420185.91840371.831260557.74
1372.5610JAN19401011940420185.91840371.831260557.74
1221.8211JAN19401111940420185.91840371.831260557.74
1128.5912JAN19401211940420185.91840371.831260557.74
1221.8213JAN19401311940420185.91840371.831260557.74
1249.5914JAN19401411940420185.91840371.831260557.74
1320.9915JAN19401511940420185.91840371.831260557.74
1267.4416JAN19401611940420185.91840371.831260557.74
1150.4117JAN19401711940420185.91840371.831260557.74
1071.0718JAN19401811940420185.91840371.831260557.74
952.0719JAN19401911940420185.91840371.831260557.74
952.0720JAN19402011940420185.91840371.831260557.74
952.0721JAN19402111940420185.91840371.831260557.74
952.0722JAN19402211940420185.91840371.831260557.74
932.2323JAN19402311940420185.91840371.831260557.74
912.4024JAN19402411940420185.91840371.831260557.74
882.6425JAN19402511940420185.91840371.831260557.74
952.0726JAN19402611940420185.91840371.831260557.74
1031.4027JAN19402711940420185.91840371.831260557.74
1090.9128JAN19402811940420185.91840371.831260557.74
1071.0729JAN19402911940420185.91840371.831260557.74
1071.0730JAN19403011940420185.91840371.831260557.74
1071.0731JAN19403111940420185.91840371.831260557.74
1150.4101FEB1940121940420185.91840371.831260557.74
1071.0702FEB1940221940420185.91840371.831260557.74
1071.0703FEB1940321940420185.91840371.831260557.74
1071.0704FEB1940421940420185.91840371.831260557.74
1071.0705FEB1940521940420185.91840371.831260557.74
1071.0706FEB1940621940420185.91840371.831260557.74
1071.0707FEB1940721940420185.91840371.831260557.74
1071.0708FEB1940821940420185.91840371.831260557.74
1071.0709FEB1940921940420185.91840371.831260557.74
1071.0710FEB19401021940420185.91840371.831260557.74
1071.0711FEB19401121940420185.91840371.831260557.74
1071.0712FEB19401221940420185.91840371.831260557.74
1071.0713FEB19401321940420185.91840371.831260557.74
1071.0714FEB19401421940420185.91840371.831260557.74
1071.0715FEB19401521940420185.91840371.831260557.74
1071.0716FEB19401621940420185.91840371.831260557.74
1071.0717FEB19401721940420185.91840371.831260557.74
1071.0718FEB19401821940420185.91840371.831260557.74
1071.0719FEB19401921940420185.91840371.831260557.74
1071.0720FEB19402021940420185.91840371.831260557.74
1071.0721FEB19402121940420185.91840371.831260557.74
1071.0722FEB19402221940420185.91840371.831260557.74
1071.0723FEB19402321940420185.91840371.831260557.74
1071.0724FEB19402421940420185.91840371.831260557.74
1071.0725FEB19402521940420185.91840371.831260557.74
1071.0726FEB19402621940420185.91840371.831260557.74
1150.4127FEB19402721940420185.91840371.831260557.74
1150.4128FEB19402821940420185.91840371.831260557.74
1249.5929FEB19402921940420185.91840371.831260557.74
1249.5901MAR1940131940420185.91840371.831260557.74
1150.4102MAR1940231940420185.91840371.831260557.74
1249.5903MAR1940331940420185.91840371.831260557.74
1249.5904MAR1940431940420185.91840371.831260557.74
1348.7605MAR1940531940420185.91840371.831260557.74
1348.7606MAR1940631940420185.91840371.831260557.74
1348.7607MAR1940731940420185.91840371.831260557.74
1348.7608MAR1940831940420185.91840371.831260557.74
1348.7609MAR1940931940420185.91840371.831260557.74
1348.7610MAR19401031940420185.91840371.831260557.74
1348.7611MAR19401131940420185.91840371.831260557.74
1348.7612MAR19401231940420185.91840371.831260557.74
1249.5913MAR19401331940420185.91840371.831260557.74
1348.7614MAR19401431940420185.91840371.831260557.74
1467.7715MAR19401531940420185.91840371.831260557.74
1467.7716MAR19401631940420185.91840371.831260557.74
1467.7717MAR19401731940420185.91840371.831260557.74
1467.7718MAR19401831940420185.91840371.831260557.74
1348.7619MAR19401931940420185.91840371.831260557.74
1348.7620MAR19402031940420185.91840371.831260557.74
1467.7721MAR19402131940420185.91840371.831260557.74
1459.8322MAR19402231940420185.91840371.831260557.74
1547.1123MAR19402331940420185.91840371.831260557.74
1547.1124MAR19402431940420185.91840371.831260557.74
1594.7125MAR19402531940420185.91840371.831260557.74
1699.8326MAR19402631940420185.91840371.831260557.74
1755.3727MAR19402731940420185.91840371.831260557.74
1699.8328MAR19402831940420185.91840371.831260557.74
1685.9529MAR19402931940420185.91840371.831260557.74
1699.8330MAR19403031940420185.91840371.831260557.74
1783.1431MAR19403131940420185.91840371.831260557.74
1840.6601APR1940141940420185.91840371.831260557.74
1797.0202APR1940241940420185.91840371.831260557.74
1713.7203APR1940341940420185.91840371.831260557.74
1685.9504APR1940441940420185.91840371.831260557.74
1713.7205APR1940541940420185.91840371.831260557.74
1797.0206APR1940641940420185.91840371.831260557.74
1741.4907APR1940741940420185.91840371.831260557.74
1755.3708APR1940841940420185.91840371.831260557.74
1824.7909APR1940941940420185.91840371.831260557.74
1854.5510APR19401041940420185.91840371.831260557.74
1783.1411APR19401141940420185.91840371.831260557.74
1713.7212APR19401241940420185.91840371.831260557.74
1741.4913APR19401341940420185.91840371.831260557.74
1927.9314APR19401441940420185.91840371.831260557.74
2122.3115APR19401541940420185.91840371.831260557.74
2082.6416APR19401641940420185.91840371.831260557.74
1943.8017APR19401741940420185.91840371.831260557.74
2042.9818APR19401841940420185.91840371.831260557.74
2280.9919APR19401941940420185.91840371.831260557.74
2816.5320APR19402041940420185.91840371.831260557.74
3054.5521APR19402141940420185.91840371.831260557.74
2697.5222APR19402241940420185.91840371.831260557.74
2538.8423APR19402341940420185.91840371.831260557.74
2677.6924APR19402441940420185.91840371.831260557.74
2757.0225APR19402541940420185.91840371.831260557.74
3054.5526APR19402641940420185.91840371.831260557.74
3510.7427APR19402741940420185.91840371.831260557.74
3391.7428APR19402841940420185.91840371.831260557.74
3391.7429APR19402941940420185.91840371.831260557.74
3153.7230APR19403041940420185.91840371.831260557.74
2935.5401MAY1940151940420185.91840371.831260557.74
3391.7402MAY1940251940420185.91840371.831260557.74
5216.5303MAY1940351940420185.91840371.831260557.74
6485.9504MAY1940451940420185.91840371.831260557.74
6823.1405MAY1940551940420185.91840371.831260557.74
6168.5906MAY1940651940420185.91840371.831260557.74
5057.8507MAY1940751940420185.91840371.831260557.74
5375.2108MAY1940851940420185.91840371.831260557.74
6981.8209MAY1940951940420185.91840371.831260557.74
9441.3210MAY19401051940420185.91840371.831260557.74
12773.5511MAY19401151940420185.91840371.831260557.74
15233.0612MAY19401251940420185.91840371.831260557.74
21024.7913MAY19401351940420185.91840371.831260557.74
17018.1814MAY19401451940420185.91840371.831260557.74
17018.1815MAY19401551940420185.91840371.831260557.74
18109.0916MAY19401651940420185.91840371.831260557.74
16502.4817MAY19401751940420185.91840371.831260557.74
16502.4818MAY19401851940420185.91840371.831260557.74
15034.7119MAY19401951940420185.91840371.831260557.74
14082.6420MAY19402051940420185.91840371.831260557.74
14082.6421MAY19402151940420185.91840371.831260557.74
15034.7122MAY19402251940420185.91840371.831260557.74
17018.1823MAY19402351940420185.91840371.831260557.74
16343.8024MAY19402451940420185.91840371.831260557.74
17514.0525MAY19402551940420185.91840371.831260557.74
19834.7126MAY19402651940420185.91840371.831260557.74
22214.8827MAY19402751940420185.91840371.831260557.74
20429.7528MAY19402851940420185.91840371.831260557.74
21619.8329MAY19402951940420185.91840371.831260557.74
21619.8330MAY19403051940420185.91840371.831260557.74
21619.8331MAY19403151940420185.91840371.831260557.74
22214.8801JUN1940161940420185.91840371.831260557.74
21619.8302JUN1940261940420185.91840371.831260557.74
19299.1703JUN1940361940420185.91840371.831260557.74
19299.1704JUN1940461940420185.91840371.831260557.74
18704.1305JUN1940561940420185.91840371.831260557.74
18704.1306JUN1940661940420185.91840371.831260557.74
17514.0507JUN1940761940420185.91840371.831260557.74
19834.7108JUN1940861940420185.91840371.831260557.74
18109.0909JUN1940961940420185.91840371.831260557.74
17514.0510JUN19401061940420185.91840371.831260557.74
18704.1311JUN19401161940420185.91840371.831260557.74
19834.7112JUN19401261940420185.91840371.831260557.74
20429.7513JUN19401361940420185.91840371.831260557.74
22214.8814JUN19401461940420185.91840371.831260557.74
21024.7915JUN19401561940420185.91840371.831260557.74
19834.7116JUN19401661940420185.91840371.831260557.74
19299.1717JUN19401761940420185.91840371.831260557.74
18109.0918JUN19401861940420185.91840371.831260557.74
17514.0519JUN19401961940420185.91840371.831260557.74
17514.0520JUN19402061940420185.91840371.831260557.74
16343.8021JUN19402161940420185.91840371.831260557.74
15233.0622JUN19402261940420185.91840371.831260557.74
14122.3123JUN19402361940420185.91840371.831260557.74
13031.4024JUN19402461940420185.91840371.831260557.74
12495.8725JUN19402561940420185.91840371.831260557.74
12495.8726JUN19402661940420185.91840371.831260557.74
11980.1627JUN19402761940420185.91840371.831260557.74
11008.2628JUN19402861940420185.91840371.831260557.74
10532.2329JUN19402961940420185.91840371.831260557.74
10314.0530JUN19403061940420185.91840371.831260557.74
10770.2501JUL1940171940420185.91840371.831260557.74
11742.1502JUL1940271940420185.91840371.831260557.74
11008.2603JUL1940371940420185.91840371.831260557.74
10076.0304JUL1940471940420185.91840371.831260557.74
10076.0305JUL1940571940420185.91840371.831260557.74
9639.6706JUL1940671940420185.91840371.831260557.74
9223.1407JUL1940771940420185.91840371.831260557.74
8826.4508JUL1940871940420185.91840371.831260557.74
8429.7509JUL1940971940420185.91840371.831260557.74
8251.2410JUL19401071940420185.91840371.831260557.74
7854.5511JUL19401171940420185.91840371.831260557.74
7676.0312JUL19401271940420185.91840371.831260557.74
7497.5213JUL19401371940420185.91840371.831260557.74
7140.5014JUL19401471940420185.91840371.831260557.74
6981.8215JUL19401571940420185.91840371.831260557.74
6823.1416JUL19401671940420185.91840371.831260557.74
6823.1417JUL19401771940420185.91840371.831260557.74
6485.9518JUL19401871940420185.91840371.831260557.74
6327.2719JUL19401971940420185.91840371.831260557.74
6168.5920JUL19402071940420185.91840371.831260557.74
6009.9221JUL19402171940420185.91840371.831260557.74
5692.5622JUL19402271940420185.91840371.831260557.74
5533.8823JUL19402371940420185.91840371.831260557.74
5375.2124JUL19402471940420185.91840371.831260557.74
5375.2125JUL19402571940420185.91840371.831260557.74
5216.5326JUL19402671940420185.91840371.831260557.74
5375.2127JUL19402771940420185.91840371.831260557.74
5216.5328JUL19402871940420185.91840371.831260557.74
5057.8529JUL19402971940420185.91840371.831260557.74
4760.3330JUL19403071940420185.91840371.831260557.74
4760.3331JUL19403171940420185.91840371.831260557.74
4601.6501AUG1940181940420185.91840371.831260557.74
4462.8102AUG1940281940420185.91840371.831260557.74
4323.9703AUG1940381940420185.91840371.831260557.74
4165.2904AUG1940481940420185.91840371.831260557.74
4026.4505AUG1940581940420185.91840371.831260557.74
4026.4506AUG1940681940420185.91840371.831260557.74
3887.6007AUG1940781940420185.91840371.831260557.74
3887.6008AUG1940881940420185.91840371.831260557.74
3768.5909AUG1940981940420185.91840371.831260557.74
3768.5910AUG19401081940420185.91840371.831260557.74
3629.7511AUG19401181940420185.91840371.831260557.74
3510.7412AUG19401281940420185.91840371.831260557.74
3510.7413AUG19401381940420185.91840371.831260557.74
3391.7414AUG19401481940420185.91840371.831260557.74
3391.7415AUG19401581940420185.91840371.831260557.74
3272.7316AUG19401681940420185.91840371.831260557.74
3272.7317AUG19401781940420185.91840371.831260557.74
3153.7218AUG19401881940420185.91840371.831260557.74
3153.7219AUG19401981940420185.91840371.831260557.74
3054.5520AUG19402081940420185.91840371.831260557.74
3153.7221AUG19402181940420185.91840371.831260557.74
3054.5522AUG19402281940420185.91840371.831260557.74
3272.7323AUG19402381940420185.91840371.831260557.74
3153.7224AUG19402481940420185.91840371.831260557.74
3054.5525AUG19402581940420185.91840371.831260557.74
3054.5526AUG19402681940420185.91840371.831260557.74
2935.5427AUG19402781940420185.91840371.831260557.74
2935.5428AUG19402881940420185.91840371.831260557.74
2816.5329AUG19402981940420185.91840371.831260557.74
2816.5330AUG19403081940420185.91840371.831260557.74
2717.3631AUG19403181940420185.91840371.831260557.74
2677.6901SEP1940191940420185.91840371.831260557.74
2618.1802SEP1940291940420185.91840371.831260557.74
2578.5103SEP1940391940420185.91840371.831260557.74
2638.0204SEP1940491940420185.91840371.831260557.74
2657.8505SEP1940591940420185.91840371.831260557.74
2538.8406SEP1940691940420185.91840371.831260557.74
2479.3407SEP1940791940420185.91840371.831260557.74
2459.5008SEP1940891940420185.91840371.831260557.74
2578.5109SEP1940991940420185.91840371.831260557.74
2677.6910SEP19401091940420185.91840371.831260557.74
2499.1711SEP19401191940420185.91840371.831260557.74
2419.8312SEP19401291940420185.91840371.831260557.74
2400.0013SEP19401391940420185.91840371.831260557.74
2538.8414SEP19401491940420185.91840371.831260557.74
2499.1715SEP19401591940420185.91840371.831260557.74
2320.6616SEP19401691940420185.91840371.831260557.74
2280.9917SEP19401791940420185.91840371.831260557.74
2300.8318SEP19401891940420185.91840371.831260557.74
2360.3319SEP19401991940420185.91840371.831260557.74
2519.0120SEP19402091940420185.91840371.831260557.74
2816.5321SEP19402191940420185.91840371.831260557.74
2598.3522SEP19402291940420185.91840371.831260557.74
2419.8323SEP19402391940420185.91840371.831260557.74
2320.6624SEP19402491940420185.91840371.831260557.74
2241.3225SEP19402591940420185.91840371.831260557.74
2241.3226SEP19402691940420185.91840371.831260557.74
2221.4927SEP19402791940420185.91840371.831260557.74
2380.1728SEP19402891940420185.91840371.831260557.74
2816.5329SEP19402991940420185.91840371.831260557.74
2816.5330SEP19403091940420185.91840371.831260557.74
2578.5101OCT19401101940420185.91840371.831260557.74
2439.6702OCT19402101940420185.91840371.831260557.74
2340.5003OCT19403101940420185.91840371.831260557.74
2400.0004OCT19404101940420185.91840371.831260557.74
2320.6605OCT19405101940420185.91840371.831260557.74
2221.4906OCT19406101940420185.91840371.831260557.74
2161.9807OCT19407101940420185.91840371.831260557.74
2122.3108OCT19408101940420185.91840371.831260557.74
2082.6409OCT19409101940420185.91840371.831260557.74
2062.8110OCT194010101940420185.91840371.831260557.74
2023.1411OCT194011101940420185.91840371.831260557.74
2003.3112OCT194012101940420185.91840371.831260557.74
2003.3113OCT194013101940420185.91840371.831260557.74
1983.4714OCT194014101940420185.91840371.831260557.74
1959.6715OCT194015101940420185.91840371.831260557.74
1900.1716OCT194016101940420185.91840371.831260557.74
1900.1717OCT194017101940420185.91840371.831260557.74
1927.9318OCT194018101940420185.91840371.831260557.74
1884.3019OCT194019101940420185.91840371.831260557.74
1854.5520OCT194020101940420185.91840371.831260557.74
1824.7921OCT194021101940420185.91840371.831260557.74
1824.7922OCT194022101940420185.91840371.831260557.74
1797.0223OCT194023101940420185.91840371.831260557.74
1783.1424OCT194024101940420185.91840371.831260557.74
1769.2625OCT194025101940420185.91840371.831260557.74
1755.3726OCT194026101940420185.91840371.831260557.74
1810.9127OCT194027101940420185.91840371.831260557.74
1824.7928OCT194028101940420185.91840371.831260557.74
1824.7929OCT194029101940420185.91840371.831260557.74
1810.9130OCT194030101940420185.91840371.831260557.74
1810.9131OCT194031101940420185.91840371.831260557.74
1810.9101NOV19401111940420185.91840371.831260557.74
1840.6602NOV19402111940420185.91840371.831260557.74
1884.3003NOV19403111940420185.91840371.831260557.74
1824.7904NOV19404111940420185.91840371.831260557.74
1741.4905NOV19405111940420185.91840371.831260557.74
1769.2606NOV19406111940420185.91840371.831260557.74
1769.2607NOV19407111940420185.91840371.831260557.74
1797.0208NOV19408111940420185.91840371.831260557.74
1769.2609NOV19409111940420185.91840371.831260557.74
1685.9510NOV194010111940420185.91840371.831260557.74
1582.8111NOV194011111940420185.91840371.831260557.74
1338.8412NOV194012111940420185.91840371.831260557.74
1285.2913NOV194013111940420185.91840371.831260557.74
1557.0214NOV194014111940420185.91840371.831260557.74
1674.0515NOV194015111940420185.91840371.831260557.74
1622.4816NOV194016111940420185.91840371.831260557.74
1594.7117NOV194017111940420185.91840371.831260557.74
1582.8118NOV194018111940420185.91840371.831260557.74
1535.2119NOV194019111940420185.91840371.831260557.74
1426.1220NOV194020111940420185.91840371.831260557.74
1582.8121NOV194021111940420185.91840371.831260557.74
1503.4722NOV194022111940420185.91840371.831260557.74
1320.9923NOV194023111940420185.91840371.831260557.74
1491.5724NOV194024111940420185.91840371.831260557.74
1535.2125NOV194025111940420185.91840371.831260557.74
1503.4726NOV194026111940420185.91840371.831260557.74
1426.1227NOV194027111940420185.91840371.831260557.74
1447.9328NOV194028111940420185.91840371.831260557.74
1479.6729NOV194029111940420185.91840371.831260557.74
1503.4730NOV194030111940420185.91840371.831260557.74
1416.2001DEC19401121940420185.91840371.831260557.74
1535.2102DEC19402121940420185.91840371.831260557.74
1557.0203DEC19403121940420185.91840371.831260557.74
1535.2104DEC19404121940420185.91840371.831260557.74
1491.5705DEC19405121940420185.91840371.831260557.74
1469.7506DEC19406121940420185.91840371.831260557.74
1416.2007DEC19407121940420185.91840371.831260557.74
1447.9308DEC19408121940420185.91840371.831260557.74
1372.5609DEC19409121940420185.91840371.831260557.74
1285.2910DEC194010121940420185.91840371.831260557.74
1160.3311DEC194011121940420185.91840371.831260557.74
1221.8212DEC194012121940420185.91840371.831260557.74
1213.8813DEC194013121940420185.91840371.831260557.74
1128.5914DEC194014121940420185.91840371.831260557.74
1136.5315DEC194015121940420185.91840371.831260557.74
1249.5916DEC194016121940420185.91840371.831260557.74
1285.2917DEC194017121940420185.91840371.831260557.74
1348.7618DEC194018121940420185.91840371.831260557.74
1372.5619DEC194019121940420185.91840371.831260557.74
1348.7620DEC194020121940420185.91840371.831260557.74
1338.8421DEC194021121940420185.91840371.831260557.74
1320.9922DEC194022121940420185.91840371.831260557.74
1328.9323DEC194023121940420185.91840371.831260557.74
1348.7624DEC194024121940420185.91840371.831260557.74
1348.7625DEC194025121940420185.91840371.831260557.74
1338.8426DEC194026121940420185.91840371.831260557.74
1360.6627DEC194027121940420185.91840371.831260557.74
1320.9928DEC194028121940420185.91840371.831260557.74
1257.5229DEC194029121940420185.91840371.831260557.74
1328.9330DEC194030121940420185.91840371.831260557.74

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
HB
Barite | Level 11 HB
Barite | Level 11

Little help on the data?

 

DailyFlow?  Date              Month    Day      Year       1/4Flow?        1/2Flow?   3/4Flow?

1360.66   01JAN1940 1 1 1940 420185.91 840371.83 1260557.74

 

 

I can do a half solution and find the dates for the single given year:

 

Data river_flow;
  input dailyflow flowdate:date9. mymonth myday myyear quarterflow halfflow threequarterflow;
  format flowdate date9.; 
  datalines;
1360.66	01JAN1940	1	1	1940	420185.91	840371.83	1260557.74
1382.48	02JAN1940	2	1	1940	420185.91	840371.83	1260557.74
1392.40	03JAN1940	3	1	1940	420185.91	840371.83	1260557.74
1404.30	04JAN1940	4	1	1940	420185.91	840371.83	1260557.74
1392.40	05JAN1940	5	1	1940	420185.91	840371.83	1260557.74
1348.76	06JAN1940	6	1	1940	420185.91	840371.83	1260557.74
1313.06	07JAN1940	7	1	1940	420185.91	840371.83	1260557.74
1328.93	08JAN1940	8	1	1940	420185.91	840371.83	1260557.74
1348.76	09JAN1940	9	1	1940	420185.91	840371.83	1260557.74
1372.56	10JAN1940	10	1	1940	420185.91	840371.83	1260557.74
1221.82	11JAN1940	11	1	1940	420185.91	840371.83	1260557.74
1128.59	12JAN1940	12	1	1940	420185.91	840371.83	1260557.74
1221.82	13JAN1940	13	1	1940	420185.91	840371.83	1260557.74

etc.

Then

 

data cumulative_flow;
    set river_flow;
    total_flow + dailyflow;
	if total_flow ge quarterflow then quarterdate= flowdate;
	if total_flow ge halfflow then halfdate= flowdate;
	if total_flow ge threequarterflow then threequarterdate= flowdate;
run;

proc sql;
 	select min(quarterdate) format date9., min(halfdate) format date9., min(threequarterdate) format date9.
	from cumulative_flow;
quit;

 gives us

 

                                22MAY1940  12JUN1940  16JUL1940

View solution in original post

5 REPLIES 5
HB
Barite | Level 11 HB
Barite | Level 11

Little help on the data?

 

DailyFlow?  Date              Month    Day      Year       1/4Flow?        1/2Flow?   3/4Flow?

1360.66   01JAN1940 1 1 1940 420185.91 840371.83 1260557.74

 

 

I can do a half solution and find the dates for the single given year:

 

Data river_flow;
  input dailyflow flowdate:date9. mymonth myday myyear quarterflow halfflow threequarterflow;
  format flowdate date9.; 
  datalines;
1360.66	01JAN1940	1	1	1940	420185.91	840371.83	1260557.74
1382.48	02JAN1940	2	1	1940	420185.91	840371.83	1260557.74
1392.40	03JAN1940	3	1	1940	420185.91	840371.83	1260557.74
1404.30	04JAN1940	4	1	1940	420185.91	840371.83	1260557.74
1392.40	05JAN1940	5	1	1940	420185.91	840371.83	1260557.74
1348.76	06JAN1940	6	1	1940	420185.91	840371.83	1260557.74
1313.06	07JAN1940	7	1	1940	420185.91	840371.83	1260557.74
1328.93	08JAN1940	8	1	1940	420185.91	840371.83	1260557.74
1348.76	09JAN1940	9	1	1940	420185.91	840371.83	1260557.74
1372.56	10JAN1940	10	1	1940	420185.91	840371.83	1260557.74
1221.82	11JAN1940	11	1	1940	420185.91	840371.83	1260557.74
1128.59	12JAN1940	12	1	1940	420185.91	840371.83	1260557.74
1221.82	13JAN1940	13	1	1940	420185.91	840371.83	1260557.74

etc.

Then

 

data cumulative_flow;
    set river_flow;
    total_flow + dailyflow;
	if total_flow ge quarterflow then quarterdate= flowdate;
	if total_flow ge halfflow then halfdate= flowdate;
	if total_flow ge threequarterflow then threequarterdate= flowdate;
run;

proc sql;
 	select min(quarterdate) format date9., min(halfdate) format date9., min(threequarterdate) format date9.
	from cumulative_flow;
quit;

 gives us

 

                                22MAY1940  12JUN1940  16JUL1940

Hydro1
Fluorite | Level 6
I think this is working, but I get missing values as SQL output ? I am pretty sure the date formatting is correct, I have used the print option, and get no error messages--please advise--thanks
HB
Barite | Level 11 HB
Barite | Level 11

I wouldn't know where to begin to "please advise" based on what has been posted.

 

Please reread @ballardw 's post to include code in a code box, data in a data step, a desired output, and a functional minimum data set.

 

  

ballardw
Super User

1) Please post code into a code box opened with the forums {I} menu icon

2) Please provide data in the form of a data step. That way we know what your variable names are and the types.

3) Provide an example of the desired output for sample data

4) Please provide just enough data to demonstrate the issue at hand.

 

It looks like you are requesting a cumulative total by day for something as the main part. I think this might be part of what you need.

 

data want;
   set new1;
   retain total 0;
   if mod(juldate(date),1000)=1 then total=0;
   total+Qcorcfs;
run;

which assume you have an actual date associated with each measurement and it is an actual SAS date value.

 

Comparing the total to those other values should be easy enough. I suspect you want something like

If total ge q25 then somevar=date.

 

Which would likely involve resetting that variable for each year, retaining the variable and only assigning if the current year's value of the variable is missing, or some flags involved.

 

When I was working with stream flow data we were more concerned with a water year that ran Oct to Sep than calendar but water budgets differ.

Hydro1
Fluorite | Level 6

I have attached a copy of the program and description of the dataset and am about to explore  your recommendations.

Yes--many hydrological applications are based on a  "water -year"  that begins Sept 30 of one year and ends December,31 of

the following year.  In snowmelt dominated basins, with little runoff  from Oct-March it generally makes little difference--but I  will

do  the analysis both ways for completeness.

 

Thanks,

Hydrol1

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 984 views
  • 1 like
  • 3 in conversation