datastep

SAS: sort error (by variable not sorted properly)

亡梦爱人 提交于 2020-01-25 00:06:25
问题 This question is a follow up from another I had here SAS: Data step view -> error: by variable not sorted properly; I am opening a new question as the desired solution is slightly different: As I am looping through several input files, one of the raw-files is not properly sorted, I wonder what I could do to make my program to skip that particular input file and just continue? Quote: I am using a macro to loop through files based on names and extract data which works fine for the majority of

SAS data step view and data wrap in a macro for loop

流过昼夜 提交于 2019-12-31 05:28:07
问题 For a university research project I am retrieving data from WRDS via SAS and am relatively new to SAS. I am trying to retrieve data in a specific interval provided by WRDS which actually works very for me; the structure is as follows [1]Define some macro variable [2]Use data step view [3]Make manipulation on data [4]Export the data to csv In particular I am retrieving data for a stock for every single year. Instead of changing the variable all the time a macro that would allow me to provide

SAS check field by field

白昼怎懂夜的黑 提交于 2019-12-11 14:05:18
问题 I try build little check process. One proc sql generated one row table (and 13 fields) and next step I need check that chosen field in the table has value <> 0. Below my current (not completed) code with example table "have": data Have; input REFERENCE_DATE L_CONTRACT L_CONTRACT_ACTIVITY L_LFC L_CONTRACT_CO_CUSTOMER L_CONTRACT_OBJECT L_CUSTOMER L_CUSTOMER_RETAIL L_DPD L_GL_ACCOUNT L_GL_AMOUNT L_EXTRA_COST L_PRODUCT; datalines; 450 1 9 8 6 0 4 3 0 0 0 0 0 ; Data work.Collect_data2; set work

SAS: Data step view -> error: by variable not sorted properly

点点圈 提交于 2019-12-11 09:24:36
问题 I am using a macro to loop through files based on names and extract data which works fine for the majority of the cases, however from time to time I experience ERROR: BY variables are not properly sorted on data set CQ.CQM_20141113. where CQM_20141113 is the file I am extracting data from. In fact my macro loops through CQ.CQM_2014: and it works up until 20141113. Because of this single failure the file is then not created. I am using a data step view to "initialize" the data and then in a

Automated grouping in SAS with minimizing variance within group

北城以北 提交于 2019-12-11 09:09:06
问题 So I tried to build the automated grouping. The goal is to select the grouping setting that has the lowest variance. In other word, I want to find x and y for the following, x,y are natural number, GROUP 1: 1997 - x GROUP 2: x+1 - y GROUP 3: y+1 - 1994 such that the SUM of (variance( Response in Group1),variance( Response in Group2),variance( Response in Group3)) are minimize. data maindat; input Year Response ; datalines; 1994 -4.300511714 1994 -9.646920963 1994 -15.86956805 1993 -16

SAS Folder Path for Metadata tables

隐身守侯 提交于 2019-12-11 03:24:18
问题 I'm wondering if anyone knows how to retrieve the sas folder path for metadata tables? I would like to list the folder path for each tables located on metadata. Example: Table FactPortfolio is under the following fodler structure in management console: Commerc-->Sweden-->Portfolios-->Resources-->Tables In metadata browser in sas, I can find the folder path if I click on tables and trees and parent trees until i reach the top hierarchy. However, I would like to retrieve it with metadata data

Open code statement recursion detected during exporting a file

怎甘沉沦 提交于 2019-12-08 09:16:12
问题 I try to export a file in SAS but I get "Open code statement recursion detected." error. Since I export more than one files depending on date I define as a macro variable based on the prompt date, I want to name my file to be exported with this variable but it does not work. I would really appreciate if anyone helps me. rep_date = 30APR2015:00:00:00 Outfile = work.A042015.sas7 %let var = CATS("A",MONTH(DATEPART(&rep_date)),YEAR(DATEPART(&rep_date))); data WORK.&var(compress=yes); set WORK

SAS error message (FATAL: Code generation error detected during MISSING smear generation)

半城伤御伤魂 提交于 2019-12-07 10:23:18
问题 Does anyone know what this error message means? FATAL: Code generation error detected during MISSING smear generation. It occurs whilst concatenating approx 40 datasets. I believe it may be due to hitting memory limits from having too many variables (circa 217), but would be good to get confirmation of this... (log file) 301 Data &dsn.&pfix.; 302 set &setlist.; 303 if SPCODE > 50 then delete; 304 * these SPCODES are subtotals ; run; FATAL: Code generation error detected during MISSING smear

SAS error message (FATAL: Code generation error detected during MISSING smear generation)

醉酒当歌 提交于 2019-12-05 14:12:22
Does anyone know what this error message means? FATAL: Code generation error detected during MISSING smear generation. It occurs whilst concatenating approx 40 datasets. I believe it may be due to hitting memory limits from having too many variables (circa 217), but would be good to get confirmation of this... (log file) 301 Data &dsn.&pfix.; 302 set &setlist.; 303 if SPCODE > 50 then delete; 304 * these SPCODES are subtotals ; run; FATAL: Code generation error detected during MISSING smear generation. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set

sas execute a macro for each instance in a data step

↘锁芯ラ 提交于 2019-12-04 06:19:34
问题 I have a macro which inserts data into a table over a set of given time-frame. It loops through a series of from-to dates (which are stored in a dataset) and runs the macro with a proc sql insert statement. When checking the data at the end of all of this, I notice that only data from the final from-to period is in the new data set. Here is my code when calling the macro in the data step. data _null_; set extract_insert_dates; %insert_table_extract(put(extract_start, date11.),put(extract_end,