BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
LearnByMistk
Obsidian | Level 7

I' m having history score files which are monthly timestamp each having somewhere 20M records and 300 features( columns) . there are 200+ such scores files in which I have update same column as null . for example:

Scorefile_20200101,Scorefile_20200201...Scorefile_20201201 etc 

 

Scorefile_202001 contains: (* id is unique)

id | var1 | var2 | var3  | var4 |..var300

1  |1      |  2.2   | 0.5    | 0.5  .....1.23

...

1000  |21      |  0.2   | 0.6    | 0.15  .....0.23

 

Now I want to update these vars with null value

code currently using sashelp.vcolumn to pull dataset name and column name 

proc sql;

 update &scorewidefile;

set &var;

run;

 

This query takes around 6 min per iteration as files are big with 20Million records and 300 columns.

 

Any alternate approach to expedite the process will be good to have.

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Onyx | Level 15

I this is what you try to achieve:

data have;
infile cards dlm="|";
input id  var1  var2  var3   var4 var300;
cards;
1  |1      |  2.2   | 0.5    | 0.5  | 1.23
1000  |21      |  0.2   | 0.6    | 0.15   | 0.23
;
run;
proc print;
run;

data want;
  set have;
  call missing(of var:);
run;
proc print;
run;

?

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

5 REPLIES 5
maguiremq
SAS Super FREQ

What variable are you trying to update? Is it the one with the (...) prefix? Please post an example using the DATALINES statement so we can see the exact issue.

yabwon
Onyx | Level 15

I this is what you try to achieve:

data have;
infile cards dlm="|";
input id  var1  var2  var3   var4 var300;
cards;
1  |1      |  2.2   | 0.5    | 0.5  | 1.23
1000  |21      |  0.2   | 0.6    | 0.15   | 0.23
;
run;
proc print;
run;

data want;
  set have;
  call missing(of var:);
run;
proc print;
run;

?

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



mkeintz
PROC Star

@yabwon wrote:

I this is what you try to achieve:

data have;
infile cards dlm="|";
input id  var1  var2  var3   var4 var300;
cards;
1  |1      |  2.2   | 0.5    | 0.5  | 1.23
1000  |21      |  0.2   | 0.6    | 0.15   | 0.23
;
run;
proc print;
run;

data want;
  set have;
  call missing(of var:);
run;
proc print;
run;

?

Bart


You can even avoid invoking the call missing for each and every observation, yet still have all the variables (except ID) set to missing in the data set:

 

data want;
  if 0 then set have;
  set have (keep=id);
run;
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
yabwon
Onyx | Level 15

Mark, one word: brilliant

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



LearnByMistk
Obsidian | Level 7

as always community is very much responsive  and helpful . Thanks all for their valuable time and response

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 505 views
  • 4 likes
  • 4 in conversation