Recently in the SAS Community Library: SAS' @BethEbersole reveals 4 steps to stop money laundering, solve law-enforcement cases, find missing children and more with SAS Visual Investigator.
Hi, I have a fiction dataset that I've created like this data countries;
length country $20 country_1 $50;
input country $ country_1 $;
datalines;
AE United Arab Emirates
AR Argentina
AU Australia
Africa Africa
Asia Asia
CA Canada
CH Schweiz
CN China
DE Germany
ET Etiopia
EU Europe
FR France
GB United Kingdom
GM Gambia
KR Republic of Korea
KZ Kazakstan
Latin_America_31 Latin America-31
Middle_East Middle East
NO Norway
NP Nepal
NZ New Zealand
Non_EU_Europe Non-EU Europe
PE Peru
PH Philippines
RU Russia
TR Turkey
UA Ukraine
World World
;
run;
data countries_extended;
set countries;
do i = 1 to ceil(ranuni(0) * 100); /* Upprepa varje land slumpmässigt upp till 100 gånger */
output;
end;
drop i;
run; and I have SAS 9.4 - which mean it can't take union all, and such. How do I create a variable a variable hierarchy, beacuse now it is mixed in col=country. I've read that you can self join in this case, but the output was bad.. Which I tried to do, but it didn't went well. Can someone please help me out?
... View more
Hi, Can anybody help me with formatting the datetime correctly in my program? I am mostly getting blank columns or getting the date as 01Jan1960:9:25:00 Etc. Here's the code I am using data x; set x; y_new = input(y, andtdtm.); format y_new datetime22.; run; And here's how some values in the datetime column look like when imported into SAS: 45348.3506829051 45349.8328009028 45350.7706134028 Thank you! Best regards, Abhishek
... View more
Hello everyone, I have survey data of approximately 5000 participants and I am currently looking to model the outcome of a dichotomized response variable to a predictor. Our question is if there is a trend of participants being more likely to be in the 1 level of the response variable as we move from 4 to 1 in the ordinal response predictor. The dichotomized response has levels 1 and 0 while the predictor is an ordinal survey response with levels 1 - "Yes - completely", 2 - "Yes - mostly", 3 - "Yes - somewhat", and 4 - "No". I am currently wondering how to structure my proc logistic code and also weighing the use of proc logistic vs. proc surveylogistic. I do not have survey weights, so it seems that proc surveylogistic would not be useful in comparison to proc logisitic. Here is my code so far: proc logistic data = import plots=all;
class outcome q1 / param=ordinal;
model outcome = q1;
run; I chose ordinal for the param= statement however I am not sure about that, though changing the param= option does not change the model fit statistics. I will continue to read documentation about proc logistic to see what other options might suit, but if there are any suggestions please let me know. Thank you!
... View more
Hello,
I have a dataset that I need to calculate the rolling average and sum. The file is attached. What I intend to do here is to calculate rolling average/sum of variables from -380 days to -20 days (I also require at least 50 non missing observations). The code is below. However, it seems that there are some very large numbers in the output files, starting from around row 800. The ouput number is not consistent with my manual calculation. I guess it might be due to the missing observations. I would like to know what I missed here. Any help is appreciated.
proc expand data = test2 out = test2;
by permno;
id date;
convert logret = logret_new/transformout=(lag 20 movsum 360 trim 70);
convert turnover = turnover_new/transformout=(lag 20 movave 360 trim 70);
convert ret = std /transformout=(lag 20 movstd 360 trim 70);
run;
... View more
The function split_part(col_name,delimiter, index) worked well with select statement in the HUE editor when connected to impala. The same function throws an error when running in SAS EG. Below is the log. I found a workaround and delivered the file. However, I want to know if anyone here knows a way to submit the code via SAS without being losing the ability to use Impala functions that SAS Access doesn’t support. Log: 66 proc sql noprint; 67 connect to impala as XXX (dsn=XXX user=XXXpw = "XXX"); 68 create table temp(compress=yes) as 69 select * 70 from connection to XXX ( 71 select 72 split_part(col, '~', 1) as col1 73 from table1 a , table2 c , table3 b 74 where condition); NOTE: Compression was disabled for data set XXX because compression overhead would increase the size of the data set. ERROR: CLI cursor extended fetch error: [Cloudera][Support] (40550) Invalid character value for cast specification. : [Cloudera][Support] (40550) Invalid character value for cast specification. : [Cloudera][Support] (40550) Invalid character value for cast specification. : [Cloudera][Support] (40550) Invalid character value for cast specification. : [Cloudera][Support] (40550) Invalid character value for cast specification. : [Cloudera][Support] (40550) Invalid character value for cast specification. : [Cloudera][Support] (40550) Invalid charact NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. 80 disconnect from XXX; NOTE: Statement not executed due to NOEXEC option. 81 quit;
... View more