Skip to content

Commit 7c14e4f

Browse files
kylebarronTomAugspurger
authored andcommitted
DOC: Add syntax highlighting to SAS code blocks in comparison_with_sas.rst (pandas-dev#20080)
* Add syntax highlighting to SAS code blocks * Fix typo
1 parent 731d971 commit 7c14e4f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

doc/source/comparison_with_sas.rst

+22-22
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ As is customary, we import pandas and NumPy as follows:
2525
This is often used in interactive work (e.g. `Jupyter notebook
2626
<https://jupyter.org/>`_ or terminal) - the equivalent in SAS would be:
2727

28-
.. code-block:: none
28+
.. code-block:: sas
2929
3030
proc print data=df(obs=5);
3131
run;
@@ -65,7 +65,7 @@ in the ``DATA`` step.
6565

6666
Every ``DataFrame`` and ``Series`` has an ``Index`` - which are labels on the
6767
*rows* of the data. SAS does not have an exactly analogous concept. A data set's
68-
row are essentially unlabeled, other than an implicit integer index that can be
68+
rows are essentially unlabeled, other than an implicit integer index that can be
6969
accessed during the ``DATA`` step (``_N_``).
7070

7171
In pandas, if no index is specified, an integer index is also used by default
@@ -87,7 +87,7 @@ A SAS data set can be built from specified values by
8787
placing the data after a ``datalines`` statement and
8888
specifying the column names.
8989

90-
.. code-block:: none
90+
.. code-block:: sas
9191
9292
data df;
9393
input x y;
@@ -121,7 +121,7 @@ will be used in many of the following examples.
121121

122122
SAS provides ``PROC IMPORT`` to read csv data into a data set.
123123

124-
.. code-block:: none
124+
.. code-block:: sas
125125
126126
proc import datafile='tips.csv' dbms=csv out=tips replace;
127127
getnames=yes;
@@ -156,7 +156,7 @@ Exporting Data
156156

157157
The inverse of ``PROC IMPORT`` in SAS is ``PROC EXPORT``
158158

159-
.. code-block:: none
159+
.. code-block:: sas
160160
161161
proc export data=tips outfile='tips2.csv' dbms=csv;
162162
run;
@@ -178,7 +178,7 @@ Operations on Columns
178178
In the ``DATA`` step, arbitrary math expressions can
179179
be used on new or existing columns.
180180

181-
.. code-block:: none
181+
.. code-block:: sas
182182
183183
data tips;
184184
set tips;
@@ -207,7 +207,7 @@ Filtering
207207
Filtering in SAS is done with an ``if`` or ``where`` statement, on one
208208
or more columns.
209209

210-
.. code-block:: none
210+
.. code-block:: sas
211211
212212
data tips;
213213
set tips;
@@ -233,7 +233,7 @@ If/Then Logic
233233

234234
In SAS, if/then logic can be used to create new columns.
235235

236-
.. code-block:: none
236+
.. code-block:: sas
237237
238238
data tips;
239239
set tips;
@@ -262,7 +262,7 @@ Date Functionality
262262
SAS provides a variety of functions to do operations on
263263
date/datetime columns.
264264

265-
.. code-block:: none
265+
.. code-block:: sas
266266
267267
data tips;
268268
set tips;
@@ -307,7 +307,7 @@ Selection of Columns
307307
SAS provides keywords in the ``DATA`` step to select,
308308
drop, and rename columns.
309309

310-
.. code-block:: none
310+
.. code-block:: sas
311311
312312
data tips;
313313
set tips;
@@ -343,7 +343,7 @@ Sorting by Values
343343

344344
Sorting in SAS is accomplished via ``PROC SORT``
345345

346-
.. code-block:: none
346+
.. code-block:: sas
347347
348348
proc sort data=tips;
349349
by sex total_bill;
@@ -369,7 +369,7 @@ SAS determines the length of a character string with the
369369
and `LENGTHC <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002283942.htm>`__
370370
functions. ``LENGTHN`` excludes trailing blanks and ``LENGTHC`` includes trailing blanks.
371371

372-
.. code-block:: none
372+
.. code-block:: sas
373373
374374
data _null_;
375375
set tips;
@@ -395,7 +395,7 @@ SAS determines the position of a character in a string with the
395395
``FINDW`` takes the string defined by the first argument and searches for the first position of the substring
396396
you supply as the second argument.
397397

398-
.. code-block:: none
398+
.. code-block:: sas
399399
400400
data _null_;
401401
set tips;
@@ -419,7 +419,7 @@ Substring
419419
SAS extracts a substring from a string based on its position with the
420420
`SUBSTR <http://www2.sas.com/proceedings/sugi25/25/cc/25p088.pdf>`__ function.
421421

422-
.. code-block:: none
422+
.. code-block:: sas
423423
424424
data _null_;
425425
set tips;
@@ -442,7 +442,7 @@ The SAS `SCAN <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/def
442442
function returns the nth word from a string. The first argument is the string you want to parse and the
443443
second argument specifies which word you want to extract.
444444

445-
.. code-block:: none
445+
.. code-block:: sas
446446
447447
data firstlast;
448448
input String $60.;
@@ -474,7 +474,7 @@ The SAS `UPCASE <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/d
474474
`PROPCASE <http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/a002598106.htm>`__
475475
functions change the case of the argument.
476476

477-
.. code-block:: none
477+
.. code-block:: sas
478478
479479
data firstlast;
480480
input String $60.;
@@ -516,7 +516,7 @@ types of joins are accomplished using the ``in=`` dummy
516516
variables to track whether a match was found in one or both
517517
input frames.
518518

519-
.. code-block:: none
519+
.. code-block:: sas
520520
521521
proc sort data=df1;
522522
by key;
@@ -572,7 +572,7 @@ operations, and is ignored by default for aggregations.
572572
One difference is that missing data cannot be compared to its sentinel value.
573573
For example, in SAS you could do this to filter missing values.
574574

575-
.. code-block:: none
575+
.. code-block:: sas
576576
577577
data outer_join_nulls;
578578
set outer_join;
@@ -615,7 +615,7 @@ SAS's PROC SUMMARY can be used to group by one or
615615
more key variables and compute aggregations on
616616
numeric columns.
617617

618-
.. code-block:: none
618+
.. code-block:: sas
619619
620620
proc summary data=tips nway;
621621
class sex smoker;
@@ -640,7 +640,7 @@ In SAS, if the group aggregations need to be used with
640640
the original frame, it must be merged back together. For
641641
example, to subtract the mean for each observation by smoker group.
642642

643-
.. code-block:: none
643+
.. code-block:: sas
644644
645645
proc summary data=tips missing nway;
646646
class smoker;
@@ -679,7 +679,7 @@ replicate most other by group processing from SAS. For example,
679679
this ``DATA`` step reads the data by sex/smoker group and filters to
680680
the first entry for each.
681681

682-
.. code-block:: none
682+
.. code-block:: sas
683683
684684
proc sort data=tips;
685685
by sex smoker;
@@ -719,7 +719,7 @@ Data Interop
719719
pandas provides a :func:`read_sas` method that can read SAS data saved in
720720
the XPORT or SAS7BDAT binary format.
721721

722-
.. code-block:: none
722+
.. code-block:: sas
723723
724724
libname xportout xport 'transport-file.xpt';
725725
data xportout.tips;

0 commit comments

Comments
 (0)