sas

What exactly is table size in SAS HashTable specified by hashexp?

眉间皱痕 提交于 2021-02-19 02:09:17
问题 I would like to have a little clarification on the definiton of a bucket in SAS hashtable. The question is exactly about the hashexp parameter. According to the SAS DOCs, hashexp is: The hash object's internal table size, where the size of the hash table is 2n. The value of HASHEXP is used as a power-of-two exponent to create the hash table size. For example, a value of 4 for HASHEXP equates to a hash table size of 24, or 16. The maximum value for HASHEXP is 20. The hash table size is not

What exactly is table size in SAS HashTable specified by hashexp?

陌路散爱 提交于 2021-02-19 02:06:37
问题 I would like to have a little clarification on the definiton of a bucket in SAS hashtable. The question is exactly about the hashexp parameter. According to the SAS DOCs, hashexp is: The hash object's internal table size, where the size of the hash table is 2n. The value of HASHEXP is used as a power-of-two exponent to create the hash table size. For example, a value of 4 for HASHEXP equates to a hash table size of 24, or 16. The maximum value for HASHEXP is 20. The hash table size is not

SAS if statement in do loop

泄露秘密 提交于 2021-02-18 19:30:55
问题 Hi I am trying to write a macro function with do loop and if statement. I think I have messed up the if-then do and do loop and I can't figure out the problem. I have a table of kids information, which contains columns like age, gender, sports, instruments etc,. My original code, which works, looks like this: data old; set new; if sports in ("football","basketball") and age <=7 then type =1; else if sports='swimming' then type=2; if special_kid=. then do; if piano ^=. and piano_1 ^=. then do;

Macro returning a value

醉酒当歌 提交于 2021-02-18 05:13:21
问题 I created the following macro. Proc power returns table pw_cout containing column Power . The data _null_ step assigns the value in column Power of pw_out to macro variable tpw . I want the macro to return the value of tpw , so that in the main program, I can call it in DATA step like: data test; set tmp; pw_tmp=ttest_power(meanA=a, stdA=s1, nA=n1, meanB=a2, stdB=s2, nB=n2); run; Here is the code of the macro: %macro ttest_power(meanA=, stdA=, nA=, meanB=, stdB=, nB=); proc power;

Macro returning a value

自古美人都是妖i 提交于 2021-02-18 05:10:22
问题 I created the following macro. Proc power returns table pw_cout containing column Power . The data _null_ step assigns the value in column Power of pw_out to macro variable tpw . I want the macro to return the value of tpw , so that in the main program, I can call it in DATA step like: data test; set tmp; pw_tmp=ttest_power(meanA=a, stdA=s1, nA=n1, meanB=a2, stdB=s2, nB=n2); run; Here is the code of the macro: %macro ttest_power(meanA=, stdA=, nA=, meanB=, stdB=, nB=); proc power;

Working of Merge in SAS (with IN=)

烈酒焚心 提交于 2021-02-16 05:31:39
问题 I have two dataset data1 and data2 data data1; input sn id $; datalines; 1 a 2 a 3 a ; run; data data2; input id $ sales x $; datalines; a 10 x a 20 y a 30 z a 40 q ; run; I am merging them from below code: data join; merge data1(in=a) data2(in=b); by id; if a and b; run; Result: (I was expecting an Inner Join result which is not the case) 1 a 10 x 2 a 20 y 2 a 30 z 2 a 40 w Result from proc sql inner join. proc sql; select data1.id,sn,sales,x from data2 inner join data1 on data1.hh_id; quit;

Working of Merge in SAS (with IN=)

故事扮演 提交于 2021-02-16 05:31:09
问题 I have two dataset data1 and data2 data data1; input sn id $; datalines; 1 a 2 a 3 a ; run; data data2; input id $ sales x $; datalines; a 10 x a 20 y a 30 z a 40 q ; run; I am merging them from below code: data join; merge data1(in=a) data2(in=b); by id; if a and b; run; Result: (I was expecting an Inner Join result which is not the case) 1 a 10 x 2 a 20 y 2 a 30 z 2 a 40 w Result from proc sql inner join. proc sql; select data1.id,sn,sales,x from data2 inner join data1 on data1.hh_id; quit;

R export to sas but cannot open

余生长醉 提交于 2021-02-11 14:35:55
问题 I export data from R to sas format with package haven . However, when I open my .sas7bdat data. It fails. library(haven) write_sas(M, "C:/Users/user/desktop/MERGED_data.sas7bdat") I provide my data structure below: Here is the properties. I double click the data to open in sas, but it fails and provides the information. Any suggestion? 来源: https://stackoverflow.com/questions/52031042/r-export-to-sas-but-cannot-open

Importing Dates from Excel to SAS

江枫思渺然 提交于 2021-02-11 13:54:07
问题 I have dates in excel in the following format 02/15/2011. When I import to excel, the dates are numeric such as 40561. When I convert these in SAS using the code below, I get dates such as 04/01/1946. So far my code is: data Reformat11; set Old; Amount1 = input(Amount, comma10.); DateReceived2 = Input(PUT(DateReceived, 5.), MMDDYY10.); Format DateReceived2 MMDDYY10.; format DateApproved MMDDYY10.; run; Any other Suggestions? 回答1: SAS knows how to import dates from Excel. What it cannot do is

When using ods excel statement stop Excel converting numbers saved as character

▼魔方 西西 提交于 2021-02-11 13:31:55
问题 I need to export some results from SAS to Excel. So far, I was using a simple proc export for that but since the export got more complex (multiple proc result s and data sets need to be mapped to one sheet) I need to find an alternative. It seems, ods excel is the way to go - and I agree, it is highly customizable - but I am facing a problem where I am not sure whether it is SAS or Excel related. Problem: When I have a SAS data set with character columns, where the data are strings of digits