Manipulating Data in Base SAS® Part 3 – Deduplicate
Recent Library Articles
Recently in the SAS Community Library: Duplicates in data can badly skew the results of an analysis. @SASJedi demonstrates data deduplication using PROC SORT with the NODUPKEY, OUT=, and DUPOUT= options and PROC SQL and PROC FedSQL
Hi all, I'm running ZINB via PROC GENMOD. Most models have run smoothly but I am running into an issue with one of my models. I'm using various child characteristics to predict zero-inflated behavioral and emotional count outcomes. Most IVs are continuous except for medication status (yes vs no). For one particular outcome, the logit portion of the model does not produce a p-value for my categorical variable, and produces the same value for the estimate and CIs; I'm not receiving any error messages. My online searches have yielded results predominately re: missing values. Here is my code and output for the logit model. Any resources/thoughts would be greatly appreciated! TITLE 'ZINB, DV = Anger Emo log'; PROC GENMOD DATA = datafile; CLASS Meds; MODEL Emotion_anger = meds time x1 x2 x3 / link = log dist = zinb offset = log_var; ZEROMODEL meds time x1 x2 x3; RUN; Logit Model Output: Analysis Of Maximum Likelihood Zero Inflation Parameter EstimatesParameter Estimate; SE; Wald 95% CI; Wald Chi-Square; p-value Intercept; df = 1 -25.4554 0.7635 -26.9518 -23.9591 1111.72 <.0001 Meds yes; df = 0 24.4313 0.0000 24.4313 24.4313 . . Meds no; df = 0 0.0000 0.0000 0.0000 0.0000 . . time; df = 1 0.0725 0.1813 -0.2828 0.4279 0.16 0.6891 x1; df = 1 5.3979 1.9872 1.5031 9.2927 7.38 0.0066 x2; df = 1 4.1286 1.5235 1.1425 7.1146 7.34 0.0067 x3; df = 1 -0.1602 0.0610 -0.2798 -0.0406 6.89 0.0087
... View more
How can I change this macro to create all the variables in one data set? I want First_ADD and Second_ADD in the out flag data set. I want to do this for multiple varibles using the macro but it keeps overwriting itself and keeping the last flag that was created by the macro. Thank you!
%MACRO FLAG(VAR1,VAR2,FLAGNAME); DATA FLAG; SET RULE1; &FLAGNAME=0; DO _N_=1 to countw(&VAR1,',') while(&FLAGNAME=0); word=scan(&VAR1,_N_,','); if word=' ' then continue; if indexw(trim(&VAR2),trim(word),',') then &FLAGNAME=1; end; drop word; run; %MEND FLAG;
%FLAG(Addresses1,Addresses2,First_ADD); %FLAG(Addresses1,Addresses3,Second_ADD);
... View more
Brand new to SAS. I'm doing something that I expect is relatively easy, but I'm struggling to get it right. The requirement is basic - I'm reading in a long file with many rows, if a record matches a criteria I want it to be shipped to a different "bypass" file that I'll work on in a later process, but it should be removed from the original read-in file. Environment is zOS - input file is defined and passed in via JCL (all working). I get the following errors if I remove my actual logic - if I leave the FILENAME statement in without referencing it there's no errors. ERROR: Invalid logical name. ERROR: Error in the FILENAME statement. ERROR: Invalid file, BYPASS_FILE. FILENAME BYPASS_FILE BYPASS1;
/***********************************************************/
/* READ FILE */
/***********************************************************/
DATA DATAIN;
INFILE DATAIN;
INPUT
@ 00001 RECORD_NUMBER $CHAR8.
@ 01769 COMPONENT_STATUS $CHAR1.
;
/*******************************************************************/
/* CREATE BYPASS FILE - USED TO STORE RECORDS WHICH HAVE AN */
/* INACTIVE COMPONENT: COMPONENT_STATUS = I */
/*******************************************************************/
IF COMPONENT_STATUS = 'I' THEN DO;
FILE BYPASS_FILE;
PUT;
DELETE;
END;
... View more
I am using the SAS elarning courses in my institution course, and assigning as homework the Virtual lab-based demos and/or activities. I want the students to be able to save their final product work of an activity/demo and upload it in the dropbox of the brightspace D2L LMS.
Are there options that enable the user to do so? if so, what is the best/easiest option? Thanks.
Kaddour
... View more
Empowers the Academic Community! Part 2 of 3.
Welcome back to our journey through the latest upgrades in SAS Visual Analytics in SAS Viya for Learners 4 . In part 1, we delved into the general enhancements. Now, let's zoom in on one of the most significant enhancements: the process of creating data items including calculated expressions and dynamic features. So, buckle up and get ready to revolutionize your data with SAS Visual Analytics.
Custom Categories: The custom categories interface has been enhanced with a new look and feel. The interface is more compact and easier to use. For interval groups, a visual shows how large each interval is compared to all other intervals.
You can also automatically generate groups from measures. You can specify the number of groups to generate. Equally sized ranges will be created, and you can edit those ranges.
Outlier detection: The new Insights window identifies possible outlier values in the data for the objects in your report. It provides a new outlier analysis pop-up window that shows how outlier values affect your data.
Measures in the Data pane are automatically checked for possible outliers. An icon appears beside measures that might have outlier values.
Expression Builder: The visual expression builder has been overhauled upgraded to use a new editor called, Monaco.
Selecting a function will automatically display the interface on the right side of the dialog, and previews will be generated automatically at the bottom of the dialog. The expression builder also includes typeahead, tab autocomplete, and hint features, dynamically giving people help along the way as they type. The new interface includes a help menu. This menu is new to SAS® Visual Analytics and describes exactly what each argument does with in the function.
A new Abbreviate numeric values option enables you to specify the scale and digits of precision.
Additional enhancements:
The min() and max() operators are now supported for dates and datetimes.
The term “quick calculation” replaces “derived item” for data items that you can create by using the new calculation pop-up menu selection on the Data pane.
Hovering over a calculated data item will reveal its expression without needing to edit the calculation.
Axes for time-series objects, line charts and more support logarithmic scales.
Excited to check out all the new features in SAS Visual Analytics in SAS Viya for Learners? Educators and students can sign up for free access to SAS Viya for Learners using an academic email address.
Stay tuned for my upcoming post unveiling the thrilling updates to Objects! Did you miss my first post on General Enhancements? If so, you can find it here:https://communities.sas.com/t5/SAS-Communities-Library/Unveiling-the-Latest-Upgrades-SAS-Visual-Analytics-Empowers-the/ta-p/932246
... View more