Questions tagged [datastep]

SAS datastep programming is the basic method of manipulating data in SAS, a 4G Statistical programming language.

This tag is intended for questions involving SAS datastep programming. It might be more appropriately answered by a SAS programmer, rather than a SAS user primarily focused on the statistical side.

SAS datastep programming involves anything between the 'data' statement and a step boundary (most commonly, 'run;', or another 'data' or 'proc' statement). It is used in SAS to input data from text files / database tables or other SAS programs, to manipulate data, and to output data to text files / database tables.

245 questions
-1
votes
2 answers

select specific rows in SAS

I have following data with multiple recording from single patient. ID date day result BELF000000084785 20111110 1 164 BELF000000084785 20111202 2 172 BELF000016833470 20070122 2 …
-2
votes
1 answer

Data Step View and Data Step: Needs to be run "separately" at first to make the script working

This question arises from two others I had regarding sending a batch job and also wraping that respective script in a macro for further loops (see here: Run SAS batch jobs via SH files: SAS script contains export to csv - where is / how to get the…
eternity1
  • 651
  • 2
  • 15
  • 31
-2
votes
1 answer

Replace strings in a column in sas

I want to replace all strings in a column with following: strings new_strings ABC_MNO_S3 S1 ABC_S1 S2 ABC_S2 S3 ABC_PQR_S3 S4 XYZ_MNO_S3 S5 XYZ_S1 S6 XYZ_S2 S7 XYZ_PQR_S3 S8 So whenever any of the above 'string' appear in…
souravsarkar59
  • 127
  • 1
  • 1
  • 8
-2
votes
1 answer

Specifying Order of Variables for SAS Report

I am working on a project where I need to specify the order of objects in the data for a custom SAS report. I am having trouble with something that should be easy, here is an example of the data I am working with. obs ord ord2 name 1 3 …
k6adams
  • 406
  • 1
  • 3
  • 12
-3
votes
1 answer

Using first function

I need to create a new variable WHLDR given the conditions below. I'm not sure the last else if is correct. So if multi > 1 and ref_1 = 0 if rel =0 and ref_1=1 then the first id which meets this condition whldr=1 if not then whldr =0, and…
user601828
  • 499
  • 3
  • 7
  • 17
1 2 3
16
17