sas

SAS to count excel observations

不问归期 提交于 2019-12-24 11:28:01
问题 I have to carry out a reconciliation of accounts for a number of excel files approximately 500 excel files. I don’t need to match accounts numbers just the volume by file. Example file 1: \\directory\Loaded\Jan2014\excel1 Example file 2: \\directory\Loaded\Feb2014\excel2 Example file 3: \\directory\Loaded\Feb2014\excel3 (account number is always populated in column B with rows 1 to 5 as the titles) Required output using above example: Main Folder (File) | Sub Folder (Jan2014) | File Name

similar statement to merge sql in sas

▼魔方 西西 提交于 2019-12-24 11:16:17
问题 hi guys i need to merge two tables in Sas but with a condition like in a sql merge statement: MERGE INTO TABLE_NAME USING table_reference ON (condition) WHEN MATCHED THEN UPDATE SET column1 = value1 [, column2 = value2 ...] WHEN NOT MATCHED THEN INSERT (column1 [, column2 ...]) VALUES (value1 [, value2 ... there is somthing like that? in case there isn't can you tell me how can i make this kind of append with condition ? 回答1: I'm not aware of any straightforward way of doing this. When I have

SAS: Taking Date data in DD-MMM-YYYY format from a csv file in a date format in a permanent data set

余生长醉 提交于 2019-12-24 10:59:11
问题 I would like to import data from a csv file in a permanent data set which has this date column with data format like "dd-mmm-yyyy" like "22-FEB-1990". I want this to be imported as date format inside the data set too. I have tried many format informats but i am not getting anything in the column. Here is the code i wrote(While I commented out certain things I have tested all the permutations and combinations with the formats and informats i could think of): libname asgn1 "C:\Users\*****\abc";

Replace missing value with previous or next observation, based on different groups

梦想与她 提交于 2019-12-24 09:27:39
问题 Here is a sample dataset. The scenario below represents a list of account transaction history: Two customers A and B; Customer A has 5 accounts 1, 2, 3, 4, 5 at Bank BA and Bank UB; Customer B has 2 accounts 1, 6 at Bank WF; Note that Bank WF has issued an account ID to B that's same as A has at Bank BA (which could be true in reality). data have; input Customer $ Account_id Bank_id $ Year; datalines; A 1 BA . A 2 UB . A 3 UB 2012 A 3 UB . A 4 UB . A 4 UB 2013 A 5 UB . B 1 WF 2014 B 1 WF . B

simple [SAS] macro in [R], how?

爱⌒轻易说出口 提交于 2019-12-24 09:20:24
问题 I have datasets called example1,example2,example3,example4 of which variable is SEX(1 or 2) in working library and I've made datasets called exampleS1,exampleS2,exampleS3,exampleS4 restricted to SEX=1 by using MACRO in SAS like this way. %macro ms(var=); data exampleS&var.; set example&var.; IF SEX=1; run; %mend ms;%ms(var=1);%ms(var=2);%ms(var=3);%ms(var=4); Now, I want to do this job in R It's bit not easy to do this in R to me. How can I do it? (assuming example1,example2, example3

SAS - pdf output with changed bookmarks

帅比萌擦擦* 提交于 2019-12-24 08:59:37
问题 My problem is as follows - I have two datasets, out of which I create through macro loop 2 * 2 graphs. I plot these two graphs into the pdf file having the first 2 graphs on the page 1 and the other graphs on the page 2. The output pdf is fine, the only thing I would like to change are bookmarks. I would like them to contain some detailed information about the graphs - one separate original bookmark per each graph. Is there some simple way how to do that ? I have found out some complicated

Mark timestamps into session in SAS

≡放荡痞女 提交于 2019-12-24 07:03:05
问题 I have a series of dataset with two variables: uid and timestamp. I want to create a new variable called "session_num" to parse the timestamps into session numbers (when two timestampes are 30 min + apart, it will be marked as a new session). For example: I try to use retain statement in sas to loop through the timestamp, but it didn't work. Here's my code: Data test; SET test1; By uid; RETAIN session_num session_len; IF first.uid THEN DO; session=1; session_len=0; END; session_len=session

Comparing start/end dates between different rows based on common data field

倖福魔咒の 提交于 2019-12-24 06:34:17
问题 SAS 9.4 Example dataset ╔═════════╦═══════╦════════════╦══════════╗ ║ subject ║ event ║ start_date ║ end_date ║ ╠═════════╬═══════╬════════════╬══════════╣ ║ s1 ║ e1 ║ 2-Mar-19 ║ 1-Jun-19 ║ ║ s2 ║ e1 ║ 1-Mar-19 ║ 1-May-19 ║ ╚═════════╩═══════╩════════════╩══════════╝ Expected Output: ╔═════════╦═══════╦════════════╦══════════╦════════════╗ ║ subject ║ event ║ start_date ║ end_date ║ query_text ║ ╠═════════╬═══════╬════════════╬══════════╬════════════╣ ║ s1 ║ e1 ║ 1-Mar-19 ║ 1-Jun-19 ║ error?

Odds ratio for ordinal variables from PROC GENMOD

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 06:03:35
问题 I have a set of data where I am creating a logistic regression model, looking at the odds of a binary outcome variable (Therapy), with Stage as an ordinal explanatory variable (0,1,2,3,4). A1c is a continuous variable. Because each patient has two eyes, I must use the repeated subject = patientID(EyeID) statement. The following is my code: PROC GENMOD data=new descend; class patientID EyeID Stage (param = ordinal) Therapy (ref ="0") Gender(ref="M") Ethnic agegroup/ PARAM=ref; model Therapy =

Odds ratio for ordinal variables from PROC GENMOD

给你一囗甜甜゛ 提交于 2019-12-24 06:03:32
问题 I have a set of data where I am creating a logistic regression model, looking at the odds of a binary outcome variable (Therapy), with Stage as an ordinal explanatory variable (0,1,2,3,4). A1c is a continuous variable. Because each patient has two eyes, I must use the repeated subject = patientID(EyeID) statement. The following is my code: PROC GENMOD data=new descend; class patientID EyeID Stage (param = ordinal) Therapy (ref ="0") Gender(ref="M") Ethnic agegroup/ PARAM=ref; model Therapy =