我在纠结一个code就是同一个文件里面merge the file with itself......
proc sql;
title "Cities' High Temps = Cities' Low Temps";
select High.City format $12., High.Country format $12.,
High.AvgHigh, ' | ',
Low.City format $12., Low.Country format $12.,
Low.AvgLow
from sql.worldtemps High, sql.worldtemps Low
where High.AvgHigh = Low.AvgLow and
High.city ne Low.city and
High.country ne Low.country;
这个是之前遇到过的一个代码,然后运营正常,但是它的variable高温和低温时分开成两组的。于是我现在有个数据
它只有一栏rate,
然后希望做出来是
里面的ur1和ur2相差小于0.02%....
于是我凌乱了:
proc sql;
title "match";
select H.Name'n1',L.Name'n2',mean(Rate)as ur1,mean(Rate)as ur2
from sql.combined, sql.postalcodes
where state_id = code and
ur1 = ur2 and
H.Name ne L.name
代码变成这样样子,但是完全不对..............
第二个问题
原始数据还是参考最上面的两个图 要求出来的结果如下:
但是我出来的结果是:
这个数字还给我一路下去....
他要求是找出 “HI”最低的失业率...
我的代码如下:
proc sql;
Title 'Question 3-lowest UR HI ';
select min(Rate) as Rate,year,month
from sql.combined
where state_id = 'HI'
group by Rate,state_id;
这到底是为啥 啊啊啊啊啊啊....